How to Write Category Descriptions in WordPress

How to Write Category Descriptions in WordPress

If you create categories on your WordPress site but do not write descriptions for that category yet and want to write now

Categories on the website help you organize your website’s content. They make it easier for people to find what they’re looking for, and they also improve your website’s visibility in search engines the category description helps a lot to do SEO of the website

In this article, I will show you how to write category descriptions on a WordPress website Before starting let me know the basic information regarding category description

What is Category Description in WordPress?

You can also write the description of the category you have created in WordPress CMS. Which is also called Category Description in technical language. As soon as the visitor clicks on that category, just before the posts of that category start, the category description written by you is visible to the visitor.

This makes it easier for visitors to understand the category and what type of posts you have included in that category. For example: When you click on any category on our Website Editorstock.com. So the Category Description looks something like this.

Category description in WordPress

Similarly, you can also write category descriptions for your WordPress website

Why Should Use Category Description in WordPress?

However, the use of Category Description is not mandatory. Still, there are some benefits of using it.

  1. Visitors get information about the category
  2. The website or blog looks organized and beautiful
  3. While choosing to write a post, you are aware of the topic of this category created by you. So that you do not include posts of other categories in it
  4. With its use, the search engine ranking of your category improves

How to Add Category Descriptions in WordPress

We can write Category Description in many ways on WordPress Blog or Website. Many WordPress plugins are also available for this. Like Category Editor etc. But today here we will discuss writing descriptions manually. Let us understand step by step one by one

Writing descriptions on an already existing category

If your category is already created. And you have written posts on that category, but have not written the description. So choose this option. Let us take the example of Category SEO available on our blog, Editorstock.com (Note: If you have hidden categories, then hidden categories will not be visible in the Category List.)

  1. Click on WordPress Dashboard>> Posts >> Categories.
  2. On the newly opened window, the category list already created by you will be visible on the right-hand side. Click on the Edit Option in which you want to write Category Description.
  3. Type your desired text in the Description Box on the New Open Window.

Writing description on a new category

If you are creating no category. And want to write a Category Description on it. So this work can be done only while creating the category. As

  1. Click on WordPress Dashboard>> Posts >> Categories.
  2. Type the name of the new category in the Name text box.
  3. Type the description of the new category in the description box.
  4. Finally, click on the Add New Category Button to save.

How to show the Category Description on the Archive Page?

By default, Category Description is already visible on the Categories Archives Page of all WordPress Themes. Still, if your Theme does not show it, then you can show the Category Description by editing the Theme Files.

For this, go to /wp-content/themes/your-current-theme/folder to connect your WordPress site to the FTP client. Now edit the category.php file there. If your theme does not have a category.php file. So you can edit the archive.php file.

Now, copy the code given below and paste it in place of your desired category description.

<?php

the_archive_description( '<div class="taxonomy-description">', '</div>' );

?>

Finally, save it. After saving, upload the file to Category Archive.

How to show Category Description in WordPress Theme?

If we want, we can show the Category Description at different places inside the WordPress Theme. Use the codes mentioned below. As

In template tag:

<?php echo category_description(1); ?>

Note: Use your Category ID instead of 1 here

In Single Post:

$catID = get_the_category(); 

echo category_description ( $catID[0] );

From the above code, out of all the categories, the category description of the first category will be visible

All Categories with Description (in the form of List)

If we want, we can show all the categories together in list format with a description. For this, the following code has to be added to the function.php file of our theme. Due to this, all the categories will be visible in the form of a plain list with descriptions.

function wpb_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('wbp_categories', 'wpb_catlist_desc');

Conclusion

The above post “How to write category description in WordPress?” In this, we learned – Why to use Category Description in WordPress? How to write a Category Description?

We learned in detail – How to write descriptions on already created or existing categories. How to write a description of a new category? How to show the Category Description on the Archive Page?

And how to show category descriptions in the WordPress theme? In which, learned to use appropriate coding in Template Tag, Single Post, and All Categories with Description (in the form of List).

The coding mentioned in the post is not for new users. Therefore, use coding only when you know coding. And before applying the code, make sure to back up your site. So that, in case of any problem or error, you can restore it back to the old state.

If you liked this post, then do share it with your blogger friends Thank you.

Leave a Comment

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

Scroll to Top