How do I call the category description (of the current post's category) on a post's single page?
My reason for wanting this is that I have a disclaimer in the category description (for instance, posts about medical subjects should not be taken as medical advice etc.).
Is the category description not part of the "loop" I hear so much about? Does it have to be called "outside the loop" unlike other tags?
You should be able to use category_description() to display the category description. You may specify a category ID. If not specified, the current category will be used.
<?php echo category_description(); ?>
Works when I supply a category ID number but when it's left blank it doesn't produce anything.
You can see it here: http://upmarketnewsletters.com/articles/test-opinion/
I figured it out:
<?php
foreach((get_the_category()) as $cat) {
echo $cat->category_description . ' ';
} ?>
navigadget
Member
Posted 6 years ago #
The above doesn't really work. It displays the main category description at all times.
So there isn't a way to show the category description without having to hard-code the category number yet.