WordPress.org

Forums

[closed] Trouble Displaying a Parent Category (1 post)

  1. greg9885
    Member
    Posted 2 years 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;
    ?>

    [duplicate: http://wordpress.org/support/topic/trouble-displaying-a-parent-category-1?replies=1
    please post only once per problem - closing this one, as the other forum might be more appropriate]

Topic Closed

This topic has been closed to new replies.

About this Topic