Display Your Category Hierarchy in a WordPress Widget

| WordPress
Display Category Hierarchy in a Widget in WordPress

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":
Using the Collapsing Categories plugin in WordPress

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.
Settings for the Collapsing Categories plugin

Publish your widget and check the end result. Your widget should look like the image below:

A widget created with the Collapsing Categories plugin

About the author

Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.