Friday, November 28, 2014

Display Category Description in Theme

This is a least used WordPress function. It is called Category Description. It is not very popular in themes. Most of themes also don't even support that. Category Description means you can add some details/description of your category in the category page. So that when some one visits your category page, they will see the description at the top of your category page before the category posts. By default most themes does not support this feature. So that when you visit the category page, you just see the posts in that category. Not the descriptions.
In this topic you can find out how to add a category description to your site. By default the Twenty fourteen theme supports Category Description.

Category Description below the Category title


Follow these steps for adding Description to your Category page:
  • For adding category description, you need to go to Dashboard > Posts > Categories.
  • Here you can see all your categories listed there.
  • Go to your category you want to add Description and edit that. There you can find a Description box. You need to add your text there which you want to display at the top of your category and Update that change.

Here is how you can add category Description


After that if your theme supports Category Description, then you can see category when you visit the category page. But if your theme does not support Category Description then you need to do a little file level Customization for achieving that.

For that please go to Appearance > Editor > archive.php/category.php and add this code wherever you want to show the Category Description:

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

Now your description is ready. You can see that in your site.