This tutorial will teach you how to display a single WordPress post category in your theme even if the article has been posted in a sub category. I created this technique for use in several WordPress themes I have developed where I only wanted to display the actual category that the article was posted in even when posted to sub categories. It’s a nice technique for themes with limited space or users that don’t want to display all categories that a post has been placed in.
Step 1: Creating A Retrieve Actual Category Function
Firstly you will want to open your current themes functions.php file then copy the code block below and paste it into your functions.php file at the bottom, close and save your functions.php file.
Continue reading “Display Single WordPress Post Category Even If Its A Sub Category”