Skip Navigation

[Resolved] Show/Hide filter and Clear filter selection by condition

This support ticket is created 4 years, 2 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 4 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1766111
filter not set.JPG
filter.JPG

Hi,

I have an Archive page, which has state and city filter.

1. can I show/hide other filters by the selection of "State" filter?
for example, from the screenshot, If I select "NSW", only "CF-Stock-NSW-City" will show on the screen.

2. Can I clear the selection of a filter?
If I select "NSW", can I clear both selections of "CF-Stock-VIC-Ctiy" and "CF-Stock-QLD-Ctiy"?
If I create a new post, there is an empty option (see screenshot), but not in a filter in archive.

#1766403

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-09-04 at 10.42.20 AM.png

Hi Wei,

Thank you for getting in touch.

If you select the search section of your Archive you should see a custom search settings sidebar. This should have the option "Show only filter options that would produce results". See Screenshot

This should make your filters dependent on each other, so only filters that will produce a result will show up.

Please let me know if this helps.
Thanks,
Shane

#1766789

No. They are different, your way is that Show only filter options that would produce results. Mine is that it has all the result, but the filter is shown based on another filter's selection.

Please note that I have the second question.

#1768375

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Wei,

Unfortunately the only condition that we can apply here is some custom javascript to hide the relevant field based on the selection.

You can use the .change() method for jQuery to hide the other fields using css based on the selection. Are you familiar enough with Javascript to craft the custom script required for this ?

In the link below there are a few examples on how the .change() method works.
hidden link

Please let me know if this helps.
Thanks,
Shane