Skip Navigation

[Resolved] Show taxonomy checkbox view filter in hierarchical.

This support ticket is created 5 years, 7 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by Himanshu Agarwal 5 years, 5 months ago.

Assisted by: Nigel.

Author
Posts
#1217473

Hi,

I am using shortcode

[wpv-control-post-taxonomy auto_fill_default="ALL" taxonomy="product_cat" type="checkboxes" format="%%NAME%%" url_param="cat" class="filter-checkboxes"]

in a view filter.

Its working fine, but i want that all check boxes are must be in hierarchical view. I mean First parent category check and then if it has child then show child. (Like wordpress default category display system).

Please help to achieve this.

#1218155

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Unfortunately Toolset does not have any support for customising the checkbox filter controls in the way you describe.

If you insert a hierarchical taxonomy filter as checkboxes, all of the terms are included with the same markup.

There is nothing to distinguish parent terms from child terms, which would be the basis for adding some custom JS, for example, to initially hide the child terms until a parent is selected.

One possible solution would be to add some custom PHP to generate the hierarchy of terms as an array, and then to make this array available on the front-end using the function wp_localize_script (see this guide to using it: hidden link).

You could then add custom JS to hide all child terms and only make them visible when the parent was selected.

In the first instance I suggest you request the ability to customise filter controls as required using this form, which goes straight to the product manager who assesses development priorities.

I can't write the code to do this for you, I'm afraid, if it is not something you are able to do yourself you'll need to seek a developer that can, e.g. a Toolset contractor: toolset.com/contractors.

#1219577

Thank You NIgel.

I dont want to check parent to show child, sorry for the confusion.

I just want to show all category in hierarchy, its not require check parent to show child .

I just want simple like this:-

Parent
-->child
-->child
-->child
Parent
-->child
-->child

No need to check parent to show child. Please help me to achieve this.

#1219651

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

It is still the case that Views doesn't differentiate between parent and child terms when outputting a taxonomy filter as checkboxes, unfortunately, and it doesn't provide any way to customise the filter output.

I encourage you to submit a feature request using this form which will go directly to the product manager who prioritises development work: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

I don't have a solution for you, I'm afraid, because Views does not include any way of customising filter controls.

You would still need to create a custom solution somewhat like I described above, passing the taxonomy as an array to the front end and then manipulating the checkbox inputs generated by Views so that they, for example, added classnames to child terms that could be used to style them differently.

But I can't write that code for you.

#1245047

Thank you!