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 use not the index.php for blogpostings, i use for all pages own templates. This works so far. But my nav-structure is a bit different as the breadcrumbs shows:

Home -> Page -> Childpage -> post

The posts on childpages 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 they show it like this:

Home -> Page -> Childpage -> Post

not like this (how its now):

Home -> Childpage -> Post

How can we do that?

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.