Breadcrumbs or Breadcrumb trail is a navigation aid used in user interfaces. It allows users to keep track of their locations within programs or documents. it provides you great SEO (Search Engine Optimization) rank flow , Increases page views and great user Interface.
Why not use plugins for Breadcrumbs
using plugins for making Breadcrumbs increases Query which results in increase in loading time of the blog. instead you can use the small PHP code for making Breadcrumb.
Installation :
- Login to WordPress Dashboard
- Navigate through Thesis >> Custom File Editor
- Now select custom_functions.php and add below code:
function thesis_breadcrumbs() { echo ''; bloginfo('name'); echo ""; if (is_category() || is_single()) { echo " » "; the_category(' • '); if (is_single()) { echo " » "; the_title(); } } elseif (is_page()) { echo " » "; echo the_title(); } elseif (is_search()) { echo " » Search Results for... "; echo '"<em>'; echo the_search_query(); echo '</em>"'; } } function display_breadcrumbs() { ?><div class="breadcrumbs"><?php thesis_breadcrumbs(); ?></div><?php } add_action('thesis_hook_after_header','display_breadcrumbs');
- Now comes the part of the CSS , so just add the below code in custom.css :
.custom .breadcrumbs { font-family:Verdana,Arial; font-size:1.2em; padding:1.2em 1em 1em 1em; border-bottom:1px dotted #666; border-top:1px dotted #666; } .custom .breadcrumbs a { color:#cc0000; border-bottom:1px dotted #fff; } .custom .breadcrumbs a:hover { border-bottom:1px dotted #cc0000; }
Customization :
How to change Breadcrumb separator ?
The default Separator is ” » ” to change it , just find for “»” (without Quotes) and replace it with any desire Separator you want.
How to remove my Blog name from the start and replace it with Home ?
Find for bloginfo(‘name’); at line 5 and replace it with echo ‘Home’;
or Just replace the whole code with the below one :
function thesis_breadcrumbs() { echo ''; echo 'Home'; echo ""; if (is_category() || is_single()) { echo " » "; the_category(' • '); if (is_single()) { echo " » "; the_title(); } } elseif (is_page()) { echo " » "; echo the_title(); } elseif (is_search()) { echo " » Search Results for... "; echo '"<em>'; echo the_search_query(); echo '</em>"'; } } function display_breadcrumbs() { ?><div class="breadcrumbs"><?php thesis_breadcrumbs(); ?></div><?php } add_action('thesis_hook_after_header','display_breadcrumbs'); |
How to change Color , Font Size and etc ?
All that is too be customized using CSS
Now we have Successfully Installed and Customized Breadcrumbs. Hope you like the Breadcrumbs if you have any idea or need any modifications then just contact me.
Sudeep Acharya says
Thanks for this i will add it.
Ritesh Sanap says
Hahaha Sudeep ,
First take a look at the title its for thesis otherwise you will bymistakely add it in Blogger :P
philip says
hi Ritesh,
thanks for the code above, it’s working well on my site.
one question though,
the breadcrumb trail ends after I navigate to another page, subsequent visits to other pages are not shown.
eg. home – about – services – portfolio
the breadcrumbs ends at home and doesn’t reflect services and portfolio.
how do i get the breadcrumbs to show additional / subsequent navigation history.
i do not have web development training, so any help us greatly appreciated.
cheers
P
Ritesh Sanap says
philip,
can you please provide me with the link to were you are using the breadcrumb so that i can help you more properly
Jennae says
I am using breadcrumbs here, everywhere except the home page: http://sandbox.hibiscuscreative.com/
How do I get the breadcrumbs to show subpages (same question as above)? For example, this page should show “HOME >> ABOUT >> ABOUT THE OWNERS >> NANCY KOLL”. Instead, it just shows HOME >> NANCY KOLL:
Can you help?
sumit says
How to remove breadcrumbs from homepage
Ritesh Sanap says
Well it depends on the theme, and also you will have to look for which function is used to call out the Breadcrumb, more information regarding the theme might help
Food Arts says
Thanks very much , this tutorial work for my site :)
Richard techgig says
Is the breadcrumbs code seo friendly to use..?
Ritesh Sanap says
Yes, Many Webmasters add it just because of SEO Purposes