Breadcrumbs play the good role in the term of SEO (Search Engine Optimization) and also it would be user-friendly to navigate to the parent pages of currently viewing page.
In this tutorial, I will explain how to add breadcrumbs without using any plugin on your WordPress site, so keep your close attention in this tutorial and follow the below steps.
WordPress Breadcrumbs Without Using Plugin
Open the functions.php file from your current activated theme folder and copy & paste below code at the end of the file.
function the_breadcrumb() { echo '
- ';
if (!is_home()) {
echo '
- '; echo 'Home'; echo " "; if (is_category() || is_single()) { echo '
- '; the_category('
- '); if (is_single()) { echo "
- "; the_title(); echo ' '; } } elseif (is_page()) { echo '
- '; echo the_title(); echo ' '; } } elseif (is_tag()) {single_tag_title();} elseif (is_day()) {echo"
- Archive for "; the_time('F jS, Y'); echo' ';} elseif (is_month()) {echo"
- Archive for "; the_time('F, Y'); echo' ';} elseif (is_year()) {echo"
- Archive for "; the_time('Y'); echo' ';} elseif (is_author()) {echo"
- Author Archive"; echo' ';} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "
- Blog Archives"; echo' ';} elseif (is_search()) {echo"
- Search Results"; echo' ';} echo '
After that use this function the_breadcrumb();
where you want to display the breadcrumbs in your web page.
The post WordPress breadcrumbs without using plugin appeared first on FreeWebMentor.
This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here