How to show “Parent Category: Subcategory” structure?
-
I’ve already searched through the Forum and the Codex so many time, but nothing I’ve found works.
I have a categories structure like this:
Category A
-Sub Category A1
-Sub Category A2Category B
-Sub Category B1
-Sub Category B2I only want to show inside each post this structure:
Entry title
Topic: Topic 1
Location: Location 1I tried the_category but this call show a list without parent relation (Categories: Topic 1, Location 1). Also I tried get_category_parents but this add the separator at the end, as we can see in the codex example:
Internet ? Blogging ? WordPress ?
Finally I ruled out use this:
<?php if ( in_category(‘4’) ): ?>
Category A: Subcategory A1
<?php endif; ?><?php if ( in_category(’11’) ): ?>
Category B: Subcategory B2
<?php endif; ?>Because this is a ugly solution for a 60 categories list. And of course, the changes on the category structure are not automaticly reflected and would be necessary edit the theme.
Any suggestions?
Thanks in advance.
- The topic ‘How to show “Parent Category: Subcategory” structure?’ is closed to new replies.