0
votes

I've a custom post type and a custom taxonomy assigned to it. I'm trying to get the categories to display in following manner.

Use: When you hover on the Parent category with child items it should display child items and the same for sub items for child category.

enter image description here

I tried using wp_list_categories() function but it returns the list in following order.

enter image description here

How do I get this to match the screenshot 1 layout?

Thanks.

1

1 Answers

0
votes

Using recursion it is possible to build the tree like parent->child structure to any level. You might need to build that custom function. Have a look at the below example which uses recursion.

Creating a recursive category tree function