child-of [x] category in CURRENT post
-
I found this code to show sub categories of [x] category and I like it, I just need to make it working as “Show sub-categories of [x] category IN CURRENT POST” because I’m going to paste this code in a widget inside posts only.
<?php $subcategories = get_categories('&child_of=4&hide_empty'); // List subcategories of category '4' (even the ones with no posts in them) echo '<ul>'; foreach ($subcategories as $subcategory) { echo sprintf('<li><a href="%s">%s</a></li>', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name)); } echo '</ul>'; ?>
What is the code that will apply this code to the post the visitor is reading?
Appreciate your help in advance.
Thank you
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘child-of [x] category in CURRENT post’ is closed to new replies.