Display category description ONLY when parent category MORE THAN 1 above
-
OK, this is going to be a challenge to describe but i’ll try…
In my archive.php I have a list of posts, I want each post to be able to display the description of the child category in which it sits… no problems, I can do that with
<?php $category = get_the_category(); echo $category[0]->category_description; ?>
. However, I only want that description displayed if the post is being listed under a category only when that parent category is more than 1 above it…Make sense? Let me try to explain it another way:
cat: XYZ
cat/sub-cat: XYZ/abc
cat/sub-cat/post: XYZ/abc/postabc archive.php = don’t show cat description of post 123
XYZ archive.php = SHOW cat description of post 123Thanks heaps on this one!
- The topic ‘Display category description ONLY when parent category MORE THAN 1 above’ is closed to new replies.