WordPress provides great flexibility to display blog posts in an organized way by separating them into categories and subcategories. So that, it is easier for the readers to find their desired posts. And, for bloggers or website owners, it becomes easier to attract readers to certain categories and posts.
However, smart bloggers are not satisfied with this single flexibility. They want more from WordPress. They also want to attract the reader’s attention to subcategories along with categories and blog posts. But the question is, how to display subcategories on category page in WordPress?
You can easily display subcategories on category pages in WordPress by following 5 simple steps.
Step 1: Install PostX Plugin
Step 2: Turn on Dynamic Site Builder Addon for PostX
Step 3: Start Creating a Custom Category Page Template
Step 4: Add a Taxonomy Block along with Post Blocks
Step 5: Choose Desired Subcategories using the Taxonomy Queries
What is the Difference Between Categories and Sub Categories?
WordPress categories are archive pages in which similar types of blog posts are grouped together to organize them and let the readers find them effortlessly.
Subcategories are the child of parent categories that are used for making niche groups of blog posts. For example, you have a category of News, so you can create subcategories like Sports News, Movie News, Gaming News, etc.
Why We Should Display Subcategories on Category Pages?
Most WordPress blogs or websites may only be required to have categories. But some blogs that have hundreds of posts within the same category, are recommended to have subcategories too.
You can easily display the categories on the WordPress menu and sidebar. But what about the subcategories? Yes, you can also display subcategories along with categories. But it may be confusing for the readers. It is recommended to highlight the child categories to make them stand out from their parent categories.
So, to get extra attention and make it easier to navigate for the readers it is important to display child categories within the category pages. So that, the visitors will not get confused and will be able to find their desired blog posts quite easily.
How to Display Subcategories on Category Page in WordPress
Now, comes the main point of this guide. As you want to display Subcategories on the Categories pages, it will be easier for you with a custom category page template. Don’t worry it is not as difficult as you may think. Just follow the below steps and you will realize how easy it is.
Step 1: Install PostX Plugin
First of all, you have to install the PostX plugin. It is a Gutenberg-based all-in-one solution for creating any kind of WordPress Blog. You can easily install this amazing from the WordPress directory. For that:
- Click on the Add New Button from the Plugins Section
- Write for “PostX” in the Search Bar
- Install and Activate the PostX Plugin
Step 2: Turn on Dynamic Site Builder Addon for PostX
As I said earlier, we will be creating a custom category page template. PostX provides an amazing Gutenberg-based Dynamic Site Builder addon. It helps to create templates for all required pages of a WordPress Blogging or News Magazine site. So, we have to turn on the addon to start using it. For that:
- Go to the Addons Section of PostX
- Turn on the Dynamic Site Builder Addon
Step 3: Start Creating a Custom Category Page Template
After turning on the Dynamic Site Builder we can start creating a custom category page template. First of all, we have to navigate to the Site Builder Section of PostX. And then we have to click on the “Add Category” button.
Here, we can see that there are some premade templates available to jump-start the creation. However, for instance, I am clicking on “Start from Scratch” as I want to create a new one.
Now, you can see a blank page. For the customization part, PostX provides some amazing blocks. For display titles of the category pages, we need to add the archive title and for blog posts, we need to add any of the post blocks. For now, I am using Post Grid 1 blocks as I want to display the posts in a grid layout.
That’s category template is almost ready. Now we just need to add subcategories to it. Which will be done in the next step. You can learn more about creating a custom category page template by clicking here.
Step 4: Add a Taxonomy Block along with Post Blocks
As we want to display subcategories on the category pages, we have to add the Taxonomy block to our desired position of the category template.
I want to display the subcategories in between the category page title and blog posts. So I am adding the taxonomy blocks in between the Archive Title and Post Block that I have already added in the previous steps. However, you can display it anywhere you want.
After adding the taxonomy blocks you can also change the layout of the block by choosing your desired design. As I want to display the subcategories in a grid layout, I am changing the default layout by choosing my desired one from the premade layout section. I am also going to change the number of columns to 1 and the number of posts to 4 query options as I want to display four subcategories.
Step 5: Choose Desired Subcategories using the Taxonomy Queries
Now comes the most important step of this blog, which is sorting subcategories instead of categories. For that, we can use the taxonomy query feature. We just need to select custom as the query type and category as the taxonomy type. Then we can choose our desired subcategories from the taxonomy value selection option.
That’s all, we are done with the steps to display subcategories on category pages in WordPress. Now, we need to publish the template. Once we click on the publish button we will see a pop-up that helps select the condition for the template that we have just created.
As I want to create a single template for all category pages, I am going to keep the condition as it is. But you can also style the category pages individually if you want to.
Now, you can go to the category pages and see how they look along with your subcategories. If you are wondering how categories and subcategories are having featured images like blog posts then you should explore the Category Addon of PostX. That helps to add featured images to categories, subcategories, tags, and any other taxonomies of your site.
Bonus: How to Show all Child Categories from Parent Category in WordPress
If you want to display all child categories from the parent category, that’s also possible by using PostX. You can do it by creating different templates for specific categories and using the taxonomy. From the taxonomy query option, select child of, then choose your desired parent category and subcategories of the parent category.
Conclusion
That’s all about displaying subcategories. I hope, now you can display subcategories on category pages in WordPress. Feel free to comment below if you face any difficulties while using the PostX plugin.
You can check out WordPress video tutorials on our YouTube Channel. Also, find us on Facebook and Twitter for regular updates!