Forums

Trouble Displaying a Parent Category (5 posts)

  1. greg9885
    Member
    Posted 1 year ago #

    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...
    Food - Dinner - Drinks - 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;
    ?>
  2. greg9885
    Member
    Posted 1 year ago #

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

  3. greg9885
    Member
    Posted 1 year ago #

    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; '); ?>

  4. greg9885
    Member
    Posted 1 year ago #

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

  5. Bad66Chevelle454
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic