Skip Navigation

[Resolved] Format Hierarchical Taxonomies in Search Filters

This thread is resolved. Here is a description of the problem and solution.

Problem: I have set up a hierarchical taxonomy for my post type, and I would like to display a custom search filter for this taxonomy using checkboxes. I have this working, but the checkboxes in my custom search form View are not indented so it appears that all the checkboxes are at the same level in the hierarchy structure.

Solution: The checkboxes filter type does not support hierarchical indentation, unfortunately. The "multi-select" filter type will show hierarchy. You could also use custom code to create your own custom filter with HTML, and use the wpv_filter_query API to integrate the filter in the search query.

Relevant Documentation: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 3 voices.

Last updated by AlexanderN4266 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#601290

I would like to display child taxonomies right below the parent taxonomies on front-end. Currently, When I go to edit a post, add new taxonomies and assign them to the parent, once I click to add the next one, this supposedly child taxonomy becomes parent taxonomy by default. Could you please advise how to solve this issue. Thanks.

#601350

Hi, I'm a bit confused by what you're describing, but it sounds like you're having a problem adding hierarchical taxonomy terms in the wp-admin post editor. Is that accurate? If so, please temporarily disable Toolset plugins and activate a default theme like Twenty Seventeen. Then create a new Draft post, and try to perform similar steps to add hierarchical category terms. Do the new terms become default parent automatically here like you described before? If so, then you are seeing a behavior that is standard for WordPress which Toolset does not modify. If not, can you provide some screenshots that show the steps to reproduce the problem? It will help me understand what's going on.

#601370
Untitled1.png
Untitled2.png

The screenshot with the problem.
On the first image there is back-end where I add the taxonomy terms. It displays no issue. The terms are listed as children as expected.
On the second image there is front-end where, unfortunately, all terms are displayed in a single column, with no parent-child relationship.

#601445

Hi,

I'm posting here to notify you that Christian is off today. he will get back tomorrow and handle your request.

Thanks.

#601591

Hi, thanks for the pictures. I understand the problem now: checkboxes taxonomy filters are not displayed hierarchically, so parent terms and child terms appear to be at the same level with no indentation. To show term hierarchy in a custom search filter, you can use the filter type "multi-select". The "checkboxes" filter type will always show a flat structure, and there's not a good way to show indentation and hierarchy in the checkbox options. If multi-select isn't appropriate for your site, you must use custom code to create your own hierarchical filter design and integrate the design using the wpv-filter-query filter:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#601774

Thanks, it was a valuable advice.