• I have quite a few categories on my site, so they’re structured using sub categories. Here’s an example of how my site works…
    FoodDinnerDrinks – Iced Tea (“Iced Tea” would be a post)

    I’d like to only show Dinner & Drinks and not “Food”. I’ve tried using a couple of other pieces of code, but no luck. The below code is what’s been the best so far. Any help would be greatly appreciated.

    <?php
            $breadcrumbs = explode('|',get_category_parents($cat,true,'|'));
            array_pop($breadcrumbs);
            array_pop($breadcrumbs);
            if ($breadcrumbs) foreach ($breadcrumbs as $crumb) echo ' / '.$crumb;
    ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter greg9885

    (@greg9885)

    I should mention I’m only trying to display the link to the category archive. This isn’t for a loop of posts.

    Thread Starter greg9885

    (@greg9885)

    I found the code below, but it’s not quite what I need. Anybody have any other ideas?

    <?php echo get_category_parents($cat, TRUE, ' &raquo; '); ?>

    Thread Starter greg9885

    (@greg9885)

    Anyone have any ideas or anything that can point me in the right direction?

    Have you been able to solve this? I was trying to do something pretty similar. I too have a few categories, but I just wanted one link in the navigation named Blogs or something like that, then have my categories listed below that.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trouble Displaying a Parent Category’ is closed to new replies.