Categories provide a simple solution for grouping similar articles together. They help the users find related content, and when used correctly, categories can help you get better SEO results too.

Besides all these benefits, categories also come with another interesting feature – the description.

It is possible to add separate descriptions for your categories and display them on the website.

Most people tend to create the categories while publishing a new post. That’s why they miss the opportunity to use category descriptions.

Display Category Description in WordPress

In today’s post, I am going to show you how to add and display the category descriptions on your WordPress site.

How to Add Category Description?

WordPress enables you to add categories while writing a new post. But that only allows you to provide the category name. That is why most people miss the opportunity to add descriptions to their categories.

To add category descriptions, go to Posts -> Categories. This will take you to a page containing all the categories of your website.

Grammarly Banner

Adding Category Description

If you are creating a new category, you will find separate fields for providing the title, slug, and the description. To add descriptions to the existing categories, click “Edit” on the category. On the resulting page, provide the description, and click “Update“. This will add the description to the category. You can use this process to add descriptions to all of your categories.

Update Category Description

It is also possible to add descriptions to your tags. To do that, go to Posts -> Tags. Similar to the categories, you can add a new tag with descriptions, or add descriptions to the existing tags by clicking the “Edit” link.

How to Display Category Description?

Some WordPress themes will automatically display the category descriptions. To check whether your theme supports that feature, open a category archive page. If the description is there, you won’t have to do anything.

Theme Category Description

In case your theme doesn’t show the category description by default, you have to edit the theme files. There are three ways to access the theme files –

  1. Using the file manager offered by your hosting provider,
  2. Using an FTP client (like FileZilla) or
  3. Going to Appearance -> Editor, and choosing the file.

After establishing the connection, go to the theme folder. First of all, look for a file named category.php. If there is no such file, look for the archive.php file. Open the file and determine where you want to show the category description. Then, put the following code into that area of the file –

<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>

This code will show the category title and the description of your desired location. Save the file and upload it back to the folder. Reload the category page, and you should see the category name and description on the page.

Displaying Category Description on Other Locations

Most WordPress themes will only show the category description on the category archive page. What if you want to display the description in other places? Well, there are several solutions to do that.

First of all, you can show a specific category description with the following code –

<?php echo category_description(3); ?>

In the above code, the number 3 is the ID of the category. To find the ID of your desired category, go to Posts > Category. Hover over your desired category, and find out the ID from the URL displayed at the bottom of the screen.

Getting Category ID

When you want to display the category description in the posts, you have to use the following code –

$catID = get_the_category();
echo category_description( $catID[0] );

And if you want to show a list of the categories with their descriptions, add the following code in the functions.php file of your theme –

function wpdean_catlist_desc() {
$string = '<ul>';
$catlist = get_terms( 'category' );
if ( ! empty( $catlist ) ) {
foreach ( $catlist as $key => $item ) {
$string .= '<li>'. $item->name . '<br />';
$string .= '<em>'. $item->description . '</em></li>';
}
}
$string .= '</ul>';
return $string;
}

add_shortcode('wpdean_categories', 'wpdean_catlist_desc');
add_filter('widget_text', 'do_shortcode');

This code will add the following shortcode to your theme –

[wpdean_categories]

Put this shortcode inside a text widget, and place the widget where you want to show the category descriptions.

Showing Category Description Widget

Final Words

Showing the description enables you to offer more information about the category. Now that you have read this tutorial, you know how to show category descriptions on your WordPress site. Let me know which method you are using.

Rate this post