How to display the child category of a specific parent category…
-
Hi,
I’m trying to get the child categories of a chosen parent to display- in the loop.
For example, imagine there are two parent-categories called ‘Colour’ and ‘Shape’, with child-categories like ‘Red’ or ‘Green’ and ‘Square’ or ‘Triangle’. I want each post to display these child categories in specific places on my template, so it’s easy to see the Colour and Shape of each post, without cluttering it up with any other categories etc.
But it’s proving a little tough, as
the_category
doesn’t seem to allow for exclusions etc in the same way aswp_list_categories
– which doesn’t work inside the loop, obviously.So I’ve been digging around the template tags and I think in_category is on the right track, but I’m not at all hot with php so I can’t really see a way to make it spit out the children, so to speak.
Any help anyone can offer would be hugely fantastic, even just a clue.
Thanks!
- The topic ‘How to display the child category of a specific parent category…’ is closed to new replies.