Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Display Breadcrumb without Plugin in WordPress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 639
    Comment on it

    Breadcrumbs are navigation links that are used by all the sites by which user can understand the hierarchy of the pages. Breadcrumbs are used to display all the pages links leading from the homepage.

      In WordPress, breadcrumbs plays an important role on the posts . There are many wordpress plugins available by which you can show the breadcrumbs easily but we recommend you not to use any plugin and to use simple code to display breadcrumbs on your WordPress website. 

    Create Breadcrumbs:

    First for creating Breadcrumbs, we have to make a function named get_breadcrumb() to generate the breadcrumb links.(you can make the function of any name) You only need to add the get_breadcrumb() function code in functions.php file in your wordpress theme you are using.

     

    function get_breadcrumb() {    // breadcrumb function
        echo '<a href="'.home_url().'" rel="nofollow">Home</a>'; //link to the homepage
        if (is_category() || is_single()) {
            echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
            the_category(' &bull; ');
                if (is_single()) {
                    echo " &nbsp;&nbsp;&#187;&nbsp;&nbsp; ";
                    the_title();
                }
        } elseif (is_page()) {
            echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
            echo the_title();
        } elseif (is_search()) {
            echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;Search Results for... ";
            echo '"<em>';
            echo the_search_query();
            echo '</em>"';
        }
    }
    After adding the function you have to all it in all pages by just putting a line code in that page

    Display Breadcrumbs:

    Call the get_breadcrumb() function in single.php or page.php file of your WordPress theme.

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

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: