Add Breadcrumb to Your Wordpress Website | Step by Step Guide

wp-breadcrumb



How to add breadcrumb to my wordpress website?

You have a wordpress website and you need to ad breadcrumb to your blog, then you easy add breadcrumb to your website with any plugin.

I will show you the exact way and the best easiest way to ad breadcrumb to your wp website.

So lets start...

Step-1: Just put the code to you wordpress theme functions.php file.

//BreadCrums============================================
function get_breadcrumb() {
    echo '<a href="'.home_url().'" rel="nofollow">Home</a>';
    if (is_category() || is_single()) {
        echo "&nbsp;&#187;&nbsp;";
        the_category(' &bull; ');
            if (is_single()) {
                echo "&nbsp;&#187;&nbsp;";
                the_title();
            }
    } elseif (is_page()) {
        echo "&nbsp;&#187;&nbsp;";
        echo the_title();
    } elseif (is_tag()) {
        echo "&nbsp;&#187;&nbsp;";
        echo single_tag_title();
    } elseif (is_search()) {
        echo "&nbsp;&#187;&nbsp;Search Results for: ";
        echo '"<strong>';
        echo the_search_query();
        echo '</strong>"';
    }
}

Step-2: Now call the function where you want to display the breadcrumb url.

<div class="breadcrumb"><?php get_breadcrumb(); ?></div>


Step-3: Add Css your theme css file.

.breadcrumb {
    padding: 8px 15px;
    margin-bottom: 20px;
    list-style: none;
    border-radius: 4px;
}
.breadcrumb a {
    color: #fe8800;
    text-decoration: none;
}


Your done.

If you are facing any problem just leave a comment.



0 Comments

Contact Us

Leave a message for further information