Reputation: 103
I have a category list from A - Z. These categories are displayed on a page. When someone clicks on ex: "A": i want them to see all the children categories which are in "A". Is there a method of showing all these children categories?
Because at the moment it will show all the posts which are in the parent "A", instead of showing all the children categories.
Example:
A: -A1 -A2 -A3 B: -B1 -B2 -B3
Upvotes: 0
Views: 604
Reputation: 68
Using the wp_list_categories() function will return a list of all categories.
You can filter the child categories using the 'depth' parameter:
All the info is in the documentation: http://codex.wordpress.org/Template_Tags/wp_list_categories
You can then use javascript to show/hide the child lists when a user clicks its parent list item.
Upvotes: 2