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.
Open the functions.php file from your current activated theme folder and copy & paste below code at the end of the file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
function the_breadcrumb() { echo '<ul id="crumbs">'; if (!is_home()) { echo '<li><a href="'; echo get_option('home'); echo '">'; echo 'Home'; echo "</a></li>"; if (is_category() || is_single()) { echo '<li>'; the_category(' </li><li> '); if (is_single()) { echo "</li><li>"; the_title(); echo '</li>'; } } elseif (is_page()) { echo '<li>'; echo the_title(); echo '</li>'; } } elseif (is_tag()) {single_tag_title();} elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';} elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';} elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';} elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';} elseif (is_search()) {echo"<li>Search Results"; echo'</li>';} echo '</ul>'; } |
After that use this function the_breadcrumb();
where you want to display the breadcrumbs in your web page.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: breadcrumbs navxt wordpress plugin, Breadcrumbs with custom post type without plugin, Breadcrumbs without a plugin, Breadcrumbs without plugin, custom breadcrumbs wordpress, how to edit breadcrumbs in wordpress, the_breadcrumb wordpress, wordpress breadcrumbs codex, wordpress simple breadcrumbs, Wordpress: Creating Breadcrumbs without a Plugin