Skip Navigation

[Gelöst] Preset value of Taxonomy filter dropdown

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

Is there some event I need to trigger to get Views to update the displayed results?

Solution:

You can try to modify your JS codes as below:

https://toolset.com/forums/topic/preset-value-of-taxonomy-filter-dropdown/#post-1367151

Relevant Documentation:

https://api.jquery.com/trigger/

This support ticket is created vor 4 Jahre, 6 Monate. 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 – 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 2 Antworten, has 2 Stimmen.

Last updated by davidS-53 vor 4 Jahre, 6 Monate.

Assisted by: Luo Yang.

Author
Artikel
#1367007

I have a wordpress archive set up with a taxonomy filter select dropdown named "wpv-product-category". When navigating to the page, I want to preset the taxonomy select option to "household". I have the following JQuery added to the JS of the filter section:

jQuery(document).ready(function($) {
jQuery("select[name^='wpv-product-category'] option[value='household']").attr("selected","selected");
});

It changes the select value just fine, but does not update the results on the page. Is there some event I need to trigger to get Views to update the displayed results?

Thanks for your help.

#1367151

Hello,

I assume you are using AJAX search option: AJAX results update when visitors change any filter values
You can try to modify your JS codes as below:

jQuery(document).ready(function($) {
	jQuery("select[name^='wpv-product-category']").val("household");
	jQuery("select[name^='wpv-product-category']").trigger("change");;
});

More help:
hidden link

#1368237

Works a treat, thanks a lot!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.