Get the current child category
-
Hi
I’m attempting to echo the current child category outside the loop the nearest I’ve found is this:
<?php
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(4, $childcat)) {
echo $childcat->cat_name;
}}
?>But can anyone let me know how to make this work outside the loop please?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get the current child category’ is closed to new replies.