How to add Category Descriptions in TwentyNineteen

Some themes implement the WordPress Category Descriptions, others do not. Often they’re not necessary, but sometimes they are. Here’s how to add them to the TentyNineteen theme.

Make a copy of the archive.php file and call it category.php. There’s a block of comments at the top, I recommend changing the description to remind you of what this file is in there for. Leave it at the root level of your (child) theme.

Find line 22 (or thereabouts), starting with the_archive_title(). This line is pulling in two lines Category Archives and your category title (Project Diary in this example).

To remove the top line, and simply print a title to the category without it becoming a URL, we can use this little workaround trick to replace the_archive_title() with this:

To add the description underneath, we can use the_archive_description() function. It’ll print out the text we set, inclusive of any formatting we choose. TwentyNineteen has several options to choose from. I’m going to use the block quote style, but feel free to use any class you like.

Hope this helps!

Jay is founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or drawing on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

You can leave a comment on my original post.