Breadcrumbs in WordPress

Historically, blogs, and thus WordPress, have never had breadcrumbs. There’s hardly any theme that has them built in, and though there were some breadcrumb plugins for WordPress, in my opinion, they sucked.

Breadcrumbs are a great utility, both for usability and SEO. They allow people and search engines to easily determine the structure of a domain. I’ve been telling clients to add breadcrumbs to their sites for as long as I can remember.

For the longest time up till now, I added the breadcrumbs on this blog directly in the theme. As you can imagine, that’s not the easiest way of doing this, because if I wanted to change the look of my breadcrumbs, I had to edit 5 or more templates.

Plus, after my WordPress SEO post in which I told people to add breadcrumbs to their theme, and couldn’t find an easy working plugin to link to, people have been bugging me to come up with a solution. Well, I’ve written that plugin!

The breadcrumbs you see on this site are created with my new Yoast Breadcrumbs plugin. It’s pretty customizable, but I bet you, as users, will come up with more options than the ones it has now, if you do, let me know in the comments!

Quite a few people have helped me test these breadcrumbs in WordPress, you know who you are, thanks for your help!

Now, go off and download the breadcrumbs plugin!

Tags:


Yoast.com runs on the Genesis Framework

Genesis theme frameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides you with the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Read our Genesis review or get Genesis now!

49 Responses

  1. SkyeBy Skye on 20 August, 2008

    Hi Joost,

    Great plugin!

    Just wondering wherabouts to insert the code – I’m not a wordpress master really!
    I’m using this template: http://wptemplates.org/?p=143

    Thanks,
    Skye

  2. FrankBy Frank on 20 August, 2008

    I think it is not realy important to use a plugin, this possible without a plugin, only a function in the theme: TUTORIAL

  3. Joost de ValkBy Joost de Valk on 20 August, 2008

    @Skye: I’ll have a look and email you

    @Frank: true, but most people don’t know how to do that, and the code in that tutorial lacks quite a few cases and options that this plugin offers.

  4. FrankBy Frank on 20 August, 2008

    OK, i understand your couses.

  5. Avaz IbragimovBy Avaz Ibragimov on 20 August, 2008

    Hey,

    Where to insert that piece of code?

  6. Joost de ValkBy Joost de Valk on 20 August, 2008

    @Frank: :)
    @Avaz: where you want the breadcrumb to appear :) usually above your the_content() call.

  7. Avaz IbragimovBy Avaz Ibragimov on 20 August, 2008

    @Joost: I’ve tried to insert it into single.php and it gives out such error:
    Parse error: syntax error, unexpected ‘{‘ in /home/.tozar/avaz/uzblogger.com/wp-content/themes/default/single.php on line 2

    The same with the index.php. I use Default WordPress theme.

  8. Anders SaugstrupBy Anders Saugstrup on 20 August, 2008

    Hi Joost

    Great idea for a useful plugin!

    I get the same error as Avaz mentiones though.

    Anders Saugstrup

  9. Lars BachmannBy Lars Bachmann on 20 August, 2008

    Hi Joost

    Great idea with a breadcrump plugin, but i also get the error that Avaz and Anders mention

  10. Joost de ValkBy Joost de Valk on 20 August, 2008

    Hey all, try the new code, (not the plugin, the insertion code) I missed a closing ) there.

  11. Anders SaugstrupBy Anders Saugstrup on 20 August, 2008

    That worked better, thanks :-)

  12. Avaz IbragimovBy Avaz Ibragimov on 20 August, 2008

    @Joost, thanks!
    Now it’s working like a charm.

    Another question, uhmm… when I tried to replace default separator to → it’s not displayin the right arrow, instead it’s outputing as a raw text, like: Home → Category → post

    What could the be problem?

  13. Joost de ValkBy Joost de Valk on 20 August, 2008

    Hmm Avaz, that’s a bug, looking into what’s causing that.

  14. Avaz IbragimovBy Avaz Ibragimov on 20 August, 2008

    oops, it seems your blog parsed the right arrow character. I’ll omit ; character in the end to explain:

    when I tried to replace default separator to → it’s not displayin the right arrow, instead it’s outputing as a raw text, like: Home &rarr Category &rarr post

  15. Joost de ValkBy Joost de Valk on 20 August, 2008

    Yes one of the PHP functions I’m using to parse the input there apparently doesn’t understand →

  16. johnBy john on 20 August, 2008

    Awesome plugin – thanks!

    It’s working perfectly except for one issue I’m having – I’m using wordpress as a CMS, and my main index page breadcrumb just says “home” in stead of “home >> blog” (ie: front page >> main index).

  17. Joost de ValkBy Joost de Valk on 20 August, 2008

    @john: what’s your site? I’d love to have a look and see if I can fix it :)

  18. johnBy john on 20 August, 2008
  19. TimBy Tim on 20 August, 2008

    Joost,

    This is great. Thank you for making this.

    But I’m also someone who needs a bit more detail on where to place the code.

    I’ve got it working on my single post page, but I’ve had problems with my archive template. None of my experiments so far have worked.

    Tim

  20. RarstBy Rarst on 20 August, 2008

    I had breadcrumbs in my theme (bundled plugin) but I soon removed it. I actually like breadcrumbs on sites with plenty of stuff and complex navigation but on wordpress everything is too close and only one click away. It’s not much use to know that you are reading post and that you came from home page.

  21. archshrkBy archshrk on 20 August, 2008

    Works like a charm but I agree with Rarst, most blogs don’t need this. Of course, those that do – will love it. I have a blog or two that may benefit from it, so keep up the great work.

  22. Christian VuongBy Christian Vuong on 20 August, 2008

    I’m a big fan of the breadcrumbs navigation. Thank you for creating this plug-in Joost!

  23. NicolasBy Nicolas on 20 August, 2008

    Thanks Joost – working really nice :)
    If I could suggest one feature… You give the option to return breadcrumb as a string (containing HTML). Why not returning an array “display” => “url”? For expert, that would give more flexbility to customize the breadcrumb.
    I.e: on my site, I “hacked” wordpress to manage a gallery of photos. And automatic breadcrumb is not working great :(
    http://localhost/photo/3035/
    So array would give me this flexibility.
    Thanks,
    Nicolas

  24. Ryan HartmanBy Ryan Hartman on 20 August, 2008

    Wondering if there’s a way to remove the post/page title from the end of the breadcrumb display? (looks a little redundant on our site.)

    Otherwise, is working great. Thanks much for the nifty plugin!

  25. Damon GudaitisBy Damon Gudaitis on 20 August, 2008

    Hi,

    I think this plugin would be even better if it supported category parents. The link I provided for my (still under construction) site illustrates the problem. If you look at the URL, it reads domain/category/subcategory/post (I used permalink custom structure with /%category%/%postname%.html to format the URL). The plugin just goes home/subcategory/post.

    I tried to get this to work myself, but I’m not much of a programmer. I’m guessing the get_category_parents function might do the trick.

  26. Joost de ValkBy Joost de Valk on 21 August, 2008

    @Nicolas: will think about it :)

    @Damon: you’re absolutely right! going to dive in to that!

  27. Online savingBy Online saving on 21 August, 2008

    Hi Joost

    Great idea for a useful plugin!

    For some reason, I stillI get the same error as mentioned above.

  28. MarkBy Mark on 21 August, 2008

    I’ve been following your WordPress SEO page closely and lost a lot of hair implementing sub par breadcrumb plugins. Thanks for building this i’ll try yours. Don’t forget to update your article! ;)

  29. Justin PalmerBy Justin Palmer on 21 August, 2008

    Joost,

    Great idea, I will be installing shortly. Just curious, how does it work if you put a post in multiple wordpress categories?

  30. Gab GoldenbergBy Gab Goldenberg on 22 August, 2008

    Heh, remember reading this tip in the SEO Book way back. Had ‘em custom coded into my theme about a year ago, n glad I did. This is gonna be wonderful for other themes though :D.

  31. Joost de ValkBy Joost de Valk on 22 August, 2008

    @Mark: good call, will do that.
    @Justin: it will pick one :)
    @Gab: glad you like it :)

  32. BertrandBy Bertrand on 23 August, 2008

    Very useful plugin. Thx !

    Too bad that when a post is in two category, only the first one appears. Perhaps you could add that, as an option, no ?

  33. Boris Mahovac - Your Ezine CoachBy Boris Mahovac - Your Ezine Coach on 24 August, 2008

    This premium WP theme by R.Bhavesh has this feature built in.

  34. Joost de ValkBy Joost de Valk on 24 August, 2008

    @Bertrand: no that’s quite impossible to do nicely.

    @Boris: I’ll check it out!

  35. lelandBy leland on 6 September, 2008

    I really love the plugin. Good Job. Quick request/comment – is there any way I can exclude a category from breadcrumbs? I have a “featured” category that keeps showing up for several articles on my site in the breadcrumbs but I use it only for a slideshow on the homepage. I would like to exclude this category from the breadcrumbs as the article also belongs to other categories. Thank.

  36. Paul MarionBy Paul Marion on 11 September, 2008

    Hey Joost, thx a million for the plugin. Installation was a breeze. Cheers.
    Paul

  37. DanBy Dan on 8 October, 2008

    Hey there -

    great article on SEO, got to the breadcrumb bit and although it works for first post all the other posts disappeared and I am getting this error message -

    Fatal error: Cannot redeclare bold_or_not() (previously declared in /home/~/plugins/yoast-breadcrumbs/yoast-breadcrumbs.php:122) in /home/~/plugins/yoast-breadcrumbs/yoast-breadcrumbs.php on line 122

    please help me! have a few posts with multiple categories and am unsure what you mean by “adapt page.php & single.php” I pasted the code in to those

    have removed code for now…

    thanks for your time and such an awesome seo guide :)

  38. MarkBy Mark on 30 October, 2008

    Hi there Joost!

    Cracking plugin and great site, going to have a good read over ALL of it!

    One thing I have noticed about the plugin is on a 404 page the current title becomes the latest post.

    Have you noticed this? Is there an easy fix or setting that needs changing?

    Thanks for any help in advance!

    Mark

  39. Boris Mahovac - Email Marketing CoachBy Boris Mahovac - Email Marketing Coach on 10 November, 2008

    This premium WordPress theme called WP Remix has this feature built in. Check it out at wpRemix.com

  40. Scott ClarkBy Scott Clark on 16 March, 2009

    I’m trying to integrate your breadcrumbs with the thesis theme as a hook function. Have you (or anyone) done this? I have not succeded yet..

    in my custom_functions.php file

    function godobreadcrumbs(){
    if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb('','');
    }
    }
    add_action('thesis_hook_after_content_box','godobreadcrumbs');

    …doesn’t work.

  41. Damon GudaitisBy Damon Gudaitis on 17 March, 2009

    This works for me….

    //output breadcrumbs
    function thesis_yoast_breadcrumbs() {
    echo ”;
    if ( function_exists(‘yoast_breadcrumb’) ) {
    yoast_breadcrumb();
    }
    echo ”;
    }

    add_action(‘thesis_hook_before_content’, ‘thesis_yoast_breadcrumbs’);
    //end breadcrumbs

    • Damon GudaitisBy Damon Gudaitis on 17 March, 2009

      The code inside the echo statement above got erased. I enclosed the breadcrumbs in div tags for styling purposes, but it’s not necessary to include the echo statements.

      • Scott ClarkBy Scott Clark on 17 March, 2009

        A huge help. Found the error – the thesis hook I was using referred to an area that was not visible, so my breadcrumbs simply didn’t display. All fixed!

  42. Aldo LatinoBy Aldo Latino on 18 March, 2009

    @ Joost

    About the issue noticed by Avaz Ibragimov in this comment, in two lines (#74 and #98) I changed “htmlentities” into “stripslashes” and it works: all my HTML special chars are now displayed correctly.

    I’d like a confirmation from you, if it’s the right way. :)
    Thank you for this useful plugin, which I’ll add into a new theme I’m developing.

  43. AnthonyBy Anthony on 21 March, 2009

    I just installed this onto some of my wordpress blogs, but it displays the same name for each different post. Check below on left hand navbar to see what i mean…

  44. PandeBy Pande on 30 November, 2009

    Hi!
    Great plugin!
    Most of my posts are in child categories: is there a way to show parent and child in the breadcrumb?
    Thank you?!

Trackbacks