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 use this snippet for breadcrumbs and it works well, but not as I need it.

function test_breadcrumbs() {
    if(!is_front_page()) {
        echo '<nav class="breadcrumb">';
        echo '<a href="'.home_url('/').'">Home</a><span class="divider">/</span>';
        if (is_category() || is_single()) {
            the_category(' <span class="divider">/</span> ');
            if (is_single()) {
                echo ' <span class="divider">/</span> ';
                the_title();
            }
        } elseif (is_page()) {
            echo the_title();
        }
        echo '</nav>';
    }
}

It shows this:

Home -> Childpage -> Post

I don't use the index.php for blog postings, instead all pages use their own templates. This works so far, but my nav-structure is a bit different than the breadcrumbs, showing:

Home -> Page -> Childpage -> Post

The posts on child pages are all in one category. I.e.:

  • home
    • page 1
      • childpage1.1 (template cat.1) [displays all posts from cat.1] -> Single Post cat.1
      • childpage1.2 (template cat.2) [displays all posts from cat.2] -> Single Post cat.2
      • childpage1.3 (template cat.3) [displays all posts from cat.3] -> Single Post cat.3

I need breadcrumbs to show like this:

Home -> Page -> Childpage -> Post

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.