Show Category Descriptions in WordPress
If you wish to add category descriptions to your WordPress site, help is at hand. Before we look at ways to display category descriptions in WP, let’s have a quick look at some of the main reasons why WordPress has become such as popular content publishing profile over recent years.
One of the most celebrated things about WordPress is the fact that that you can change the design of your site extremely quickly without compromising the quality of its appearance. There are thousands of themes to choose from and an active global community of WP experts willing to help you out if you do ever find yourself stuck and require advice on making its many features work for you. Plugs in enable you to boost the functionality of your site massively, even if you only have the most basic knowledge of programming. More than 10,000 plugins are on offer, and new ones are being developed and launched all the time. Whether you need a plug in for social media integration, photos, SEO or many other purposes, help is available.
Updating a WP site is easy. Anyone who can create a Word document can publish an article on WP. What’s more is that the search engines treat WP sites extremely favourably, and Google has recommended WordPress for business sites.
If you do wish to display category descriptions on your site, read on. Categories are incredibly useful and can boost the WP experience not only for you but your visitors too. They enable you to organise content with ease and make it much easier for users to find it. Furthermore, they are great for SEO.
WordPress has two built-in taxonomies known as categories and tags. The taxonomies make it easy to sort content into topics. In WordPress, you can add descriptions to categories, which is something many WP users remain unaware of because they can create categories when writing posts which don’t let them add descriptions.
To get around this, go to the Posts » Categories page. If you are creating a new category, you can enter the name and description and click on the ‘Add new category’ button.
You can also add descriptions to categories that already exist by clicking on the ‘edit’ button beneath said category. Do this and you’ll be taken to the category edit screen which lets you add a description. Click the ‘update’ button so your changes are not lost.
You can go through this process again as many times as you need to until all your categories have descriptions. The same method enables you to add descriptions for your tags.
Do you need to show category descriptions on the Category Archive Page?
Whilst many WP themes automatically show the category description on the category archive pages, this is not always the case. If your theme is not showing category descriptions on archive pages, you can put things right by editing your theme files. Use an FTP client to connect to your WP site and go to /wp-content/themes/your-current-theme/ folder. Find and edit your category.php file. If your theme doesn’t have one, you can edit the archive.php file. Copy and paste the following code in the place you want your category description to be shown.
1
<?php
2
the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ );
3
?>
Save the changes and upload the file to your website. Once you have done this, you can head to the category archive page on the site to view the description.
Show Category Description in WordPress Theme
You can use the category_description template tag below to show the category description in other areas of your website.
<?php echo category_description(3); ?>
Replace 3 with your own category ID.
Use the code below to display category descriptions inside a single post.
1
$catID = get_the_category();
2
echo category_description( $catID[0] );
This code will get all the categories for the current post and output the category description of the first category.
You can list each of your WordPress categories with a description in list format by adding the code below to your theme’s functions.php file:
01
function wpb_catlist_desc() {
02
$string = ‘<ul>’;
03
$catlist = get_terms( ‘category’ );
04
if ( ! empty( $catlist ) ) {
05
foreach ( $catlist as $key => $item ) {
06
$string .= ‘<li>’. $item->name . ‘<br />’;
07
$string .= ‘<em>’. $item->description . ‘</em> </li>’;
08
}
09
}
10
$string .= ‘</ul>’;
11
12
return $string;
13
}
14
add_shortcode(‘wpb_categories’, ‘wpb_catlist_desc’);
The above code will create a shortcode. This will display all categories and the descriptions that go with them in a plain list. You will then be able to use [wpb_categories] in your posts and pages. Enable shortcodes for widgets if you need to use the shortcode in a text widget.
More about Category Descriptions
The Category Description function is overlooked by many but can be incredibly useful. You may have seen the category description on many occasions without noticing it. Many people glance over this box when they are setting up and editing descriptions. Though not all WordPress site owners require or even want a category description, descriptions can provide your users with valuable information, make your site more exciting and efficient and boost the SEO of your site.
Do I need to use Category Descriptions?
Category Descriptions may prove invaluable if you regularly post about various topics and feel it would be beneficial to divide the content on your site into sections. If you don’t specify a category, your post will be filed in the default one, which is often ‘Uncategorized’. You can change your default category in the Settings » Writing screen. Posts don’t have to come under a single category – they can be filed under various different fields, which is very handy if you are posting content that suits a number of different fields. Your WP Posts can also have tags as well as categories. More and more WP users are experiencing the benefits of Category Descriptions.