How To's

How to display category descriptions in WordPress?

Most of the WordPress users tend to ignore the category description option. Category descriptions allow you to give a brief info about what your category is about. It helps you to easily sort content on your website.

category description option wordpress

In this article, you will learn how to display category descriptions in WordPress:

The very first step is to go to posts and click on the categories page. If you are creating a new category, then enter category name and description together or else click on “edit” option below the category name.

edit category description wordpress

When you click on “edit” edit category will appear on the screen. Add the category description and click on “Update” button to save the changes. You can add category description in all existing categories.

Display category description on category archive page

Most of the WordPress themes display the category description on the category archive pages.

category descriptions on archive page wordpress

In case, your theme does not display category description on archive page then you need to edit your theme files. Follow the steps given below:

  • Connect your WordPress site using an FTP Client.
  • Go to /wp-content/themes/your-current-theme/folder.
  • Locate and edit category.php.file.
  • If your theme does not have category.php.file then edit archive.php.file.
  • Copy paste the following code:

category descriptions code

Save your changes and upload the file back to your website. Visit your website and check the category description in action.

Display category description in WordPress theme

To display the category description in other parts of your website, use the category_description template tag:

<?php echo category_description(3); ?>

Replace the number “3” with your own category ID. To display category description inside the post then use the following code:

$catID = get_the_category();

echo category_description( $catID[0] );

The above-mentioned code gets all categories for the current post and then outputs the category description of the first category. To list all your WordPress categories with a description in list format, add following code in your theme’s functions.php file:

category description in list format code wordpress

This code will create a shortcode. You will be able to see categories and descriptions in a plain list. To use this shortcode inside a text widget, you have to enable shortcodes for widgets.

list category description wordpress

Everyone does not require to add a category description. It helps you to liven up your website. It is also useful for the SEO of your category pages. We hope this article helped you to learn how to add and display category descriptions in WordPress.

Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

Close