Skip Navigation

[Gelöst] Sorting taxonomy terms in filter

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

Last updated by marcB-6 vor 3 Jahre, 4 Monate.

Assisted by: Christian Cox.

Author
Artikel
#1869893
Schermafbeelding 2020-12-09 om 11.41.47.png

Hi guys,
i try to find a way to sort the values in a filter (dropdown, see screenshot). All values come from one taxonomy. I see that i can only sort them ascending and descending. Is there any way to sort them in a custom order?
Thanks!
Marc

#1870867

It depends on the order you want to achieve. We use the get_terms API from WordPress to query terms, so it may be possible to filter get_terms using an orderby parameter:
https://developer.wordpress.org/reference/functions/get_terms/#parameters
https://developer.wordpress.org/reference/classes/wp_term_query/__construct/#parameters

However, an arbitrary sort order isn't really possible in this query because of WordPress API limitations. In that case, you can see how to set up your own arbitrary sort order manually in a wpv-control shortcode here:
https://toolset.com/forums/topic/wpv-control-need-to-customize-the-order-of-the-taxonomy-terms/

#1871461

Thanks Christian, we'll dive into it. If any questions, i'll open a new thread.
Marc

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