category_description

CATEGORY TAG

What It Does

Displays the description of a given category if one exists.

Code

<?php echo category_description($category); ?>

You can set which category description to display by using its numerical category ID set by WordPress. You can choose not to set a category ID and use the category_description tag on a category page, which would simply display the current category’s description by default.

Example

<p><?php echo category_description(14); ?></p>

The above code would display the category descripotion for category number 14. If a category description has not been set, it will return with:

<br />

Category Slug

This will display the category description using a category slug.

<p><?php echo category_description(get_category_by_slug(‘category-slug’)->term_id); ?></p>

<strong>Category Title</strong>

This will display the category description along with the category title.

<code>
<p><?php single_cat_title(‘Now viewing’); ?>: <?php echo category_description(); ?></p>

For more information see single_cat_title