WordPress Breadcrumb code without plugin using tags category and date

All the WordPress breadcrumb code that I have seen deals with categories and dates only. However for better navigation and SEO, I believe tags should also be part of it too.

WordPress Breadcrumb code vs Tag clouds

If tags are a part, they can provide quick and easy access to all related articles for the readers. Tag clouds which are used quite often for this purpose get quite congested and messy after sometime. With inclusion of tags directly in WordPress breadcrumb code, a reader does not have to locate the tags from the tag clouds but instead could get all relevant articles via a nicely laid out breadcrumb.
Another advantage of having tags in WordPress breadcrumb code is that it creates a new page with highly relevant keyword (the tag) that users might be searching for. The search engines could index that page and provide it in their search results. Consider a case where a user might be searching forĀ tutorial. If you have a page for the tag tutorial it would be considered a very relevant page and shown to the users (by search engines) searching for term tutorial.

WordPress Breadcrumb code with tags but without any plugin

Implementing it without any plugin has a definite advantage. It keeps the changes simple without overhead of extra plugin code. Plus even if you use a plugin you are required to change theme code anyway. To implement WordPress breadcrumb code in your blog without any plugin put the following piece of code in your single.php file to show breadcrumb for all posts. It can also be placed anywhere in the theme you would like to implement it.

<div id="wordpress-breadcrumb-code">
<a href="<?php $blogurl = bloginfo('url') ; ?>" title="<?php bloginfo('name'); ?>">Home</a>
<?php the_category(' > ') ?> 
<?php the_tags(' > ', ' > ', ' - '); ?>
<? $month = get_the_time('m') ; 
   $day = get_the_time('d') ; 
   $year = get_the_time('Y') ; ?>
<a href="<?php echo $blogurl ; ?>
         /<? echo $year ?>
         /<? echo $month ?>">
         <? echo $month . '/' . $day . '/' . $year ;?>

Now add this to your style.css file:

#wordpress-breadcrumb-code { color: #808080; font-size: 10px; }
#wordpress-breadcrumb-code a{ color: #808080; font-size: 10px; }

Basically there are four sections to this. First is home page, second is category, third is tag and fourth is archive (articles for month in a year). This should cover all the relevant information for a post for easy navigation for users and great SEO for search engines.

Related Posts