How to add Breadcrumbs in WordPress

How to add Breadcrumbs in WordPress

Breadcrumbs or in Castilian bread crumbs, is the elements in charge to mark the pursuit sign until a certain page of the website where we were.

These elements are created with the aim of orienting the user, so that this it has visible the exact place of the website where it is, and the pages that they precede until arriving here. In addition, it is used in the same way to facilitate the task of indexing in finders, since that the user, the spider of the web search engine also will know to interpret the way that there is until arriving at a certain page, facilitating therefore the tracking of certain pages of site which structure and urls are at several levels of depth in the architecture (. While greater level of depth has a certain page, more complicated it will be to arrive until her, and more complicated it will have to be valued and rankeada in Google).

Next we observed an example of breadcrumb:

Levels of depth:

  • Academy of English (home)
    • Courses (page of listing of courses)
      • English for children (a determined course, current page)
/* English example of breadcrumb * Academy English €œCourses of€ Courses of English for children

Forms to add Breadcrumbs in WordPress

If our WordPress group does not have implemented by defect a system of breadcrumbs or for some certain reason we want to use other types of bread crumbs, the possibilities to add breadcrumbs in wordpress are the following:

  • 1. Breadcrumbs in WordPress with Yoast SEO plugin

    If we used famous plugin SEO by Yoast, and want to add breadcrumbs, we must do the following thing:

    Within the options outposts of Yoast we marked the square €œto activate bread crumbs€ and formed the rest of parameters to our pleasure.
    breadcrumbs yoast

    Now we have left to introduce the code php in charge to call to the function of breadcrumbs of yoast and to paint it in the wished zone of our group of page, for example in the case of my example she is in page.php, and I place it right in the section that paint under header and upon the_content (contained of the body of page or main).

    <? php to get_header (); > <? php the_post (); >
    
    
    //I make the call to the function here <? php if (function_exists (€˜yoast_breadcrumb€™)) \ {yoast_breadcrumb (€˜<p id= " breadcrumbs " >€™, €˜</p>€™);}}? > //finishes the code here that I must insert 
    
    <? php the_content (); > <? php to get_footer (); >

    If the case that occurred it did not want to include breadcrumb in certain pages of my site, as contact, legal warning or others. I can exclude surrounding them this function within a condition if

    <? php to get_header (); > <? php the_post (); does > //if you have some of these ids of page ok, enter and dot breadcrumb, we can use all type of conditions, I leave it to your taste <? php if (is_page (€˜2272€™) || is_page (€˜2271€™) || is_page (€˜3328€™) || is_page (€˜2359€™) || is_page (€˜2885€™) || 
    is_page (€˜2294€™) || is_page (€˜2305€™) || is_page (€˜2313€™) || is_page (€˜2320€™)) \ {if (function_exists (€˜yoast_breadcrumb€™)) \ {yoast_breadcrumb (€˜<p id= " breadcrumbs " >€™, €˜</p>€™);} 
    
    }? >
    
    
    
    <? php the_content (); > <? php to get_footer (); >
  • 2. Breadcrumbs in WordPress with Plugins

    If we do not want to enter the code and to add to the function php with the call to yoast, you can show preference for the fastest option, than it is to install plugin specific to create and to customizar breadcrumb, for it I advise to you Smart Navigation Breadcrumb
    plugin breadcrumb

  • 3. PHP Breadcrumbs in WordPress

    If we want it to do without Yoast and plugins, that is to say, to really implement breadcrumb to our WordPress group through PHP, we must add the following function to our file function.php of warms up to you:

    //PHP to add Breadcrumb to WordPress   
    function the_breadcrumb () \ {if (! is_home ()) \ {
    		I throw €˜<span title=€€™;
    		I throw get_option (€˜home€™);
    	        I throw €˜€œ>€™;
    		bloginfo (€˜yam€™);
    		I throw €œ</span>€ €œ;
    		if (is_category () || is_single ()) \ {
    			the_category (€˜title_li=€™);
    			if (is_single ()) \ {
    				I throw €œ€œ€œ;
    				the_title ();
    			}
    		} elseif (is_page ()) \ {
    			I throw the_title ();
    		}}}    
    //aim of breadcrumb

    Now we go to the place of the group where we want to paint breadcrumb, I in this I marry I use the same site that elegi in case 1 with Yoast (between head and the_content):

    <? php to get_header (); > <? php the_post (); > //hacemos the call to the function that we have created previously <? php the_breadcrumb (); >
     
    >
    
    
    <? php the_content (); > <? php to get_footer (); >
  • If you know some other method to add breadcrumbs in WordPress, or want to give to your opinion or point of view to this post, you can comment and participate.

    it comments

    If you liked this article or she served as help comp¡rtelo please to you
    A greeting,
    Oscar/Whitechsolutions
    By “scar Carrillo