Support » Plugins » [Plugin: Yoast Breadcrumbs] Links as list items

  • Hey all,

    As I was looking for a decent breadcrumbs plugin, I stumbled upon Yoast Breadcrumbs. Looks pretty good, but being a fan of semantic HTML I figured it’d be even nicer if the breadcrumbs were displayed as list items. (My personal preference is an ordered list).

    I took the time to edit the plugin, adding the option to output the links themselves (and not the ‘you are here’ text) as a list, with another option allowing you to choose whether it should be an <ul> or an <ol>.

    For who just wants the plugin, see below.
    For those interested in how the code itself works, a brief summary:

    – the options ‘islist’ and ‘listtype’ were added to the admin cp (and the $opt array)
    – each time the breadcrumbs’ link output is started (three different occasions, each for a different type of page, look for $output = ***) a <li> is started
    – each time a separator is parsed (look for $opt['sep']) the previous list item is closed after the separator, and a new one is immediately opened
    – each time the last element of the breadcrumbs is parsed (look for bold_or_not(***)) again the previous list item is closed, and a new <li class="last"> is opened. After the last element a final closing </li>is placed. This way the last element can be styled more than just bold.
    – Inside the breadcrumbs div, directly after the ‘you are here’ text the list (ul or ol, your choice) is opened. The list is closed after the last breadcrumb.

    Ideally the breadcrumbs plugin would not be generated as a string ($output) but as an array of crumbs, which gets parsed into the preferred code only at the end, but this would require a lot of re-coding and I’m just a tad too lazy for that. Maybe later, but that way it’d be my own plugin whereas right now the credits can still go to Yoast, who served us a very useful plugin (among many others) 🙂

    Anyway, the code:

    I’m not sure if Yoast himself reads these forums, but if this is not allowed (or if it’s such a good idea it makes it’s way into the official plugin) I can be contacted at stephan[at]



  • The topic ‘[Plugin: Yoast Breadcrumbs] Links as list items’ is closed to new replies.