Display Your Category Hierarchy in a WordPress Widget
One of our members at OSTraining set up an ecommerce site using Easy Digital Downloads. She wanted to create a widget to show the store’s categories to visitors. However, she could only get the top level categories to display.
In this tutorial, we’ll show you how to create a widget that can show any number or level of WordPress categories.
- Install and enable the Collapsing Categories plugin
- Appearance -> Widgets
- You’ll now see a new widget type called “Collapsing Categories”. Click on it.
- Click “Add Widget”:
On the right side, you can now configure your widget. As you can see, there a lot of settings. This is a powerful plugin!
If you’re new to WordPress, the two most important options that might need explaining are:
- Taxonomy type: This is going to correspond to the type of category you want to display (in my example, it’s a downloads category from Easy Digital Downloads)
- Post type: This corresponds to the type of item that’s from that specific taxonomy type.
Publish your widget and check the end result. Your widget should look like the image below: