WordPress – How To Create an Easy Breadcrumb Trail Without a Plugin
You can create an easy breadcrumb trail in WordPress without any fancy plugin by doing the following:
Add this code to your functions.php file within your theme:
function the_breadcrumb() {
if (!is_home()) {
echo '';
bloginfo('name');
echo " » ";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
Then add this to the file where you want the breadcrumb trail to appear, usually header.php:
< ?php the_breadcrumb(); ? >
Important Note: The code above has a *space* at the start and end of the php code to stop the editor from messing it up.