In my quest to make my category pages index worthy, last week I added manual excerpts to my WordPress archive pages. This week I altered my WordPress code to show category descriptions on the category pages, adding yet more unique content to these pages. Your theme might show these category descriptions out of the box, but most don’t, including mine. Here’s what I did: step by step.
Before you alter your theme to show the category description on your category pages, make sure you have something to show. Click on the “Categories” menu item in the WordPress admin and then add a category description as I have done below. You may want to also pick a more “catchy” name for your category.
As I mentioned above, most WordPress themes do not show the category descriptions on the category pages, but some do, so it’s worth a quick check to see if your descriptions are showing. If so, you are done! If not, read on.
We will be updating the same file we updated last week
archive.php. As before, you need to be comfortable with updating code and uploading files to your web server. The archive.php file has a number of if statements determining what type of archive page we are dealing with, so find the if block
if (is_category()) as you only want to modify the code for the category archives (tags don’t have descriptions). You’ll see a line of code that prints out (using printf or echo) the category name, you may want to modify that so instead of “Posts in Category X” it just displays your sexy new category name. Underneath that you will want to add the following code:
<?php echo category_description( $category_id ); ?>
Upload your file and your category descriptions should now be displaying.
Note: You may need to add some formating around the above code to get it to display in a good looking font and style. This will be dependent on your theme’s CSS. One hack to try is to display it within h2 or h3 tags.
Kathy Alice Brown is a traffic and conversion expert specializing in SEO, Copywriting and Facebook Ad Campaigns. In her spare time she loves to get outside.