Skip Navigation

[Resolved] Sorting view results

This support ticket is created 6 years 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
- 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 1 reply, has 2 voices.

Last updated by Luo Yang 6 years ago.

Assisted by: Luo Yang.

Author
Posts
#901808

I have a post with a custom taxonomy. That custom taxonomy has a single option. Is it possible to sort my search results to list posts that have this taxonomy selected first?

For instance:

Post One (Custom taxonomy "on_sale" has the item "clearance" selected )
Post Seven (Custom taxonomy "on_sale" has the item "clearance" selected )
Post Four (Custom taxonomy "on_sale" has the item "clearance" selected )
Post Two (Custom taxonomy "on_sale" has nothing selected )
Post Three (Custom taxonomy "on_sale" has nothing selected )
Post Five (Custom taxonomy "on_sale" has nothing selected )

Thanks

#901830

Hello,

No there isn't such a built-in feature within Views.

Views plugin is using WordPress class WP_Query to query the posts, there isn't such an option to order the result by custom taxonomy:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

So you might consider to use a custom field to replace the custom taxonomy "on_sale"

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