How to display category information on your WordPress website

One of the most powerful features of WordPress is the ability to categorize your posts into a group. Categories allow you to bring together similar posts. Apart from helping your users find relevant content, categories can also help you get better visibility from search engines.

Category descriptions in WordPress can help you better define your categories and improve your SEO.

How to update your category description

Navigate to your WordPress Admin Dashboard. Click on Posts > Categories.

On the Categories page, you can edit your category or add a new one. You can update your category description by putting relevant content in the Category description box.

Once you add the text to the description, reload your category page to see the description. This is how the category description displays on your theme.

How to add your category information in WordPress

Activating the category description on the Archive Page

Most themes support category descriptions out of the box, but if your theme doesn’t – you will need to edit your theme files.

To do this, log in to your HostPapa account. Click on My cPanel and then on File Manager. 

Your website’s file manager will now show up. From here, navigate to your root WordPress directory and then its theme folder (in this example, the root WordPress directory is public_html, so the theme folder is in public_html/wp-content/themes/ location)

Inside your theme folder, we are looking to edit the category.php file. If your theme does not have one, you can edit the archive.php file. Click on archive.php or category.php file and press the Edit button.

Once the file opens up in the editor, copy and paste the below code wherever you would like to show it in the theme. This code fetches the description of the current category and displays it.

the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ );

Save the file, and head to your archives page, usually at, to see the updated description being reflected.

Displaying the category description on a single post

Most themes will show the category description only on the archive page. You can modify the code to showcase category descriptions even on a single post page.

In your File Manager, select the file single.php and press the Edit button.

When your single.php file opens up, you can copy and paste the below code within the “while” loop. Save it and click on any of your posts to see the output. You would now see the category description for any single post.

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

Show a list of categories on your website

Using a bit of code it is easy to showcase the list of categories anywhere on your site.

In your File Manager, select functions.php and edit the file.

Scroll to the bottom of the file and paste this code in the file. Now save it by clicking Save Changes.

function hostpapa_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(‘hostpapa_categories’, ‘hostpapa_catlist_desc’);
add_filter(‘widget_text’, ‘do_shortcode’);

This will enable the shortcode “hostpapa_categories” for your theme. Create a new post (or page) and paste your shortcode in the post content. Publish your content by clicking on the Publish button.

Category information for WordPress

Often one of the least used features of WordPress, Category description allows you to describe the categories. Your users will get a better idea of the category and the search engines will index this information leading to better SEO, so a net win-win.

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Related Articles