How Can I Create a Categories and Sub-categories Menu in WordPress?
I’ve seen this question asked a lot on the WP Forums and WP Stack Exchange along with several different answers. It really comes down to what you need. So, we’ll go over how to create a categories and sub-categories menu in two different ways and the pros/cons of each in this part of the tutorial.
First, before we get into this, did you know that a WordPress categories menu can be created without code and will also be editable on the dashboard? WpTavern tells you how!
Still interested in trying the PHP way? Awesome, let’s move on.
The two easiest ways to make this menu happen is to use either wp_list_categories or get_the_category_list. After we review them both, you can decide which option best suits your needs.
In Part 2 of this tutorial ( coming soon ), we’ll be going over how to write a categories and sub-categories menu from scratch using get_categories(). For now though, let’s get started with Part 1!2 Comments