Skip Navigation

[Resolved] Show/Hide a Filter depending on which taxonomie is selected.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 8 replies, has 2 voices.

Last updated by melanieG-2 1 year, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2582813

Tell us what you are trying to do?
I have different post type that I display all on this page: hidden link.
The different post types have different fields and I would like to be able to show the filters for these fields only when the corresponding category is selected.

For example, if someone select "Parks" then the filter "Amenities" (showing below) should then show - but it should be hidden when "All" is selected.

Is there any documentation that you are following?
Several
https://toolset.com/forums/topic/conditional-filters-on-search-view/
https://toolset.com/forums/topic/we-are-creating-a-map-filter-which-will-display-multiple-custom-post-types/

I know this will require custom jquery or javascript and I don't have much knowledge of this language. It might be outside of your scope but I thought it was worth a shot. Thank you for your help!

#2582919

Hello,

It needs custom JS codes, please provide a test site with the same problem, fill below private message box with test site credentials, also point out the problem page URL and view URL, I can setup a demo for you

#2583363

I have tried the credentials you provided above, but can only see htaccess login window, can you check it? make sure it is a valid admin account, then update here.

#2583633

The FTP address is hidden link

I don't know how to send a private answer. The rest of the info should be good.

#2583851
credentials.jpg

No, I am talking about "WordPress access details", see my screenshot.

#2584275

oh, sorry. the site was password protected and I didn't notice. you should be able to login now, I removed the protection.

#2585707

Thanks for the details, I can login into your website, will update here if find anything

#2585717

I have done below modifications in your website:
Edit the post view:
hidden link
in section "Search and Pagination", click "JS Editor", add below codes:

jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
	/**
	* data.view_unique_id (string) The View unique ID hash
	* data.view_changed_form (object) The jQuery object for the View form after being updated
	* data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode
	* data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode
	*/
  if(jQuery('input[name="wpv-explore-map-category"][value="0"]').prop('checked')){
  	jQuery('div.filters-parks.filters-section').hide();
  }
  if(jQuery('input[name="wpv-explore-map-category"][value="parks"]').prop('checked')){
  	jQuery('div.filters-parks.filters-section').show();
  }
	
});


  if(jQuery('input[name="wpv-explore-map-category"][value="0"]').prop('checked')){
  	jQuery('div.filters-parks.filters-section').hide();
  }
  if(jQuery('input[name="wpv-explore-map-category"][value="parks"]').prop('checked')){
  	jQuery('div.filters-parks.filters-section').show();
  }

It works fine in frontend:
hidden link

For your reference.

#2588311

Thank you! I think I should be good to go.