Support » Fixing WordPress » showing categories and subcategories using THE_CATEGORY ??

  • hey there.

    i’m trying to find a way to use the “<?php the_category( ); ?>” tag to display the hiarchical relationship between my category and its subcategory.

    to clarify: if a post is in the subcat “monkeys” whose parent category is “primates” i want the_category to return “primates > monkeys”. obviously the > sign is arbitrary. the point is that the_category only shows the category a post is placed in, and makes no reference to the parent category? is there a way around this? besides posting the entry in both “primates” and “monkeys”?


Viewing 3 replies - 1 through 3 (of 3 total)
  • I think if you use something like <?php the_category(', ','single') ?> then it will show both the parent and child, separated by a /.

    See here:

    yes, that is correct, but – and feel free to call me anal – i am really hoping to find a way that will list them and let me control whether it’s a link or just a list, and also lets me dictate the seperating character.

    <?php the_category_rss(‘ , ‘,’ single ‘) ?> returns the category from the post and its parent, but only as a single link and only seperated by the \ … i’m hoping to find something more flexable.

    the_category is meant to only display the link of the post it is referenced to. You are looking for another wp function:

    wp_list_cats() – It makes a nice little list of all your categories, with links.

    <?php wp_list_cats(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘showing categories and subcategories using THE_CATEGORY ??’ is closed to new replies.