Last updated on November 28, 2011. Tags: category description
The category description is... well, a description of a category in WordPress. It provides the webmaster or blogger a brief explanation of what falls under a particular category. Bloggers who are very systematic in classifying their post will find this feature very useful.
Shown below are the WordPress administration panels wherein you can read the category description. The left figure shows the list of categories together with their respective category descriptions, slugs and numbers of posts. When you click on the category name, you will arrive in an interface shown in the right figure, wherein you can edit the attributes of that category including its category description.
A WordPress blog can call the category description using the PHP code shown below:
<?php if ( is_category() ) { echo category_description(); } ?>
The if argument is_category() ensures that the category description of that category is called if the dynamic page IS a category page. As of the writing of this post, I still haven't tried calling the category description from a dynamic page that is not a category page (I don't see any need for that as of this moment). Perhaps, you would like to experiment on it and share the results to us.
One thing noticeable on category description is that it uses the echo, something that is usually used by strings of text that are directly typed on the PHP code. Texts that are called from the database, such as post excerpt and post content, do not use echo. I do not know why category description needs to use echo but it simply does not work when the echo is not there.
Most WordPress themes do not readily display the category description. Moreover, unlike post excerpt, the actual use of category description is not obvious. Most bloggers and webmasters are already satisfied with having the capability to organized the posts into categories. However, category description can be useful in several different ways depending on the creativity and needs of the blog. I was able to come up with two ways of using category description:
Posted by Greten on March 14, 2009 under Definitions, WordPress
Comment Rules and Reminders