Cat and subcat breadcrumbs (3 posts)

  1. ericrosenfield
    Posted 11 years ago #

    High, I'm trying to add breadcrumbs to my site for categories and sub-categories. In other words, if you click a post in Category A, Sub Category B, I'd like it to say at the top:
    Category A >> Sub Category B

    I tried adding this to category.php:
    <h2 class="pagetitle"><? if (get_category_parents(the_category_ID(FALSE))) { echo get_category_parents(the_category_ID(FALSE)); }?><?php echo single_cat_title(); ?></h2>

    But that both always returns the current category as it's own parent if your already in a top-level category, and seems to work strangely with multiple sub-categories (you get Category A >> Sub-Category B >> Sub-Category C when you should get Category A >> Sub-Category C)

    Any ideas?

  2. iand
    Posted 11 years ago #

    Use a breadcrumbs plugin instead?

  3. ericrosenfield
    Posted 11 years ago #

    Yeah, that works mostly... I had to edit it a little and add a preg expression and ucwords to get the formatting how I wanted it, but better than what I was trying. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.