I believe breadcrumb is a very important section of complicated structured website, the reason it stops visitors to get lost in between the complex hierarchical linking and helps them to revisit the pages any time in between the surfing. Personally I also believe that somehow breadcrumb also helps in boosting the website SEO.

Though there are so many ready made plugins available to add Breadcrumb in WordPress websites, with multilingual support and one of them I suggest is Breadcrumb NavXT. But if your website do not have multilingual feature then I will not suggest using any third plugins and instead I suggest to go for the short code snippets like bellow. And this is the most easiest and shortest code snippet to add breadcrumb in WordPress.

Adding Breadcrumb in WordPress

1. Locate functions.php in you current activated theme and paste the below code in it.

function MyBreadcrumb() {
    if (!is_home()) {
        echo '<a href="';
        echo get_option('home');
        echo '">';
        echo 'Home';;
        echo "</a> » ";
        if (is_category() || is_single()) {
            the_category('title_li=');
            if (is_single()) {
                echo " » ";
                the_title();
            }
        } elseif (is_page()) {
            echo the_title();
        }
    }
}

2. Locate single.php and page.php under your current activated theme folder and past the bellow code where you want to display the breadcrumb at.

<?php MyBreadcrumb(); ?>

Related posts:


  • http://download.cnet.com/Free-Iso-Burner/3000-2646_4-75628059.html free iso burner

    Thanks for your point of view.

  • Srinivas

    Amit, good tutorial.

    Just want to let you know that the comments here from quincy real estate onwards are all spam and they are trying to get backlinks from your website.

  • Vibin

    How to create breadcrumbs for pages with heirarchy..like Home -> Parent Page -> Subpage etc…?