How to Create a Category Page with a List of Subcategories

by Matt Giovanisci | Last Updated: June 21, 2020

I get asked a lot how to build a massive category page complete with subcategories and links to posts. This is because it’s how my category pages look on SwimUniversity.com. It looks like this.

So I’m providing the code, but you’ll need to structure your content in WordPress a certain way.

Remember, there is no customer service for the Carbonate theme. I’m providing this code as a jumping-off point. Customize it however you want. Code at your own risk.

1. Structure the Content

First, you need to have one main category. On SwimUniversity.com, I only have two: Pool Care and Hot Tub Care.

Then, you need to create subcategories under each main category.

2. Update The category.php Page

Now, we can modify the category.php page to find the main category ID, then loop through all the subcategory titles, and loop the posts under those subcategories in a unordered list format.

Here’s an example of a single Subcategory listing under the Pool Care main category page: