Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know there are several questions regarding how to use the menu hierarchy for breadcrumbs and I followed the instructions doing the following...

I added this code to my theme's functions file:

/** Breadcrumbs from Menu Structure

function menu_breadcrumbs($theme_location = 'main', $separator = ' » ') {

    $items = wp_get_nav_menu_items($theme_location);
    _wp_menu_item_classes_by_context( $items ); // Set up the class variables, including current-classes
    $crumbs = array();

    foreach($items as $item) {
        if ($item->current_item_ancestor || $item->current) {
            $crumbs[] = "<a href=\"{$item->url}\" title=\"{$item->title}\">{$item->title}</a>";
    echo implode($separator, $crumbs);

Then I added this to the page template:

<?php menu_breadcrumbs('primary-menu'); ?>

All this works, BUT... I really need the breadcrumbs to show all options for each main category, if that makes sense...

For examples on my events page (http://www.sciotomile.com/events/), the code above creates a breadcrumb trail consisting of the main category and then the current page (like this: Events >> Events Calendar). For many sites this would be perfect, but my site doesn't have any subpages of subpages (in other words there are only 2 levels to my page structure). So I would like the breadcrumbs to show all options under the current category or tier and then underline or bold or whatever the current page...

So instead of this:

Events >> Events Calendar

I would see this:

Events >> Events Calendar >> Rhythm on the River >> FountainSide >> Jazz & Rib Fest >> Grand Illumination >> Plan an Event

I would also like to see the option for "Home" provided...

Anyway, if anyone can help me, I would really appreciate it :)

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.