Skip Navigation

[Resolved] Custom field secondary sorting in the Views plugin

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

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)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#601801

Hi!

I've got a website where listings can get a 'featured location' and show up in the top of the list. So i've sorted my view by the featured locations field. After the featured locations, I would like the list to sort secundary by rating with the WP-PostRatings plugin (the 'ratings_average' field).

I only see some basic options when setting up the secondary sorting. Is it possible to sort the list by featured locations first, and ratings second?

Thanks,
Tim

#601902

Dear Tim,

As you can see, the option "Secondary sorting" only supports few basic options, it does not support custom field, if you agree, we can take it as a feature request, our developers will evaluate it.

Currently, I suggest you try with Views filter hook "wpv_filter_query", to apply the "secondary sorting" by custom field, see our document:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
When displaying a View listing posts, this filter is applied to the arguments being generated by the View settings before they are passed to the WP_Query class.

https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

#602148

Hi Luo,

Thanks for the fast reply. I would like to see this feature in a future update. 🙂

#602390

As your request, I forward it to our supporter Beda, he manages the feature request of Views plugin, our developers will evaluate it, but there isn't any ETA for it, you can subscribe to our blog to get the updated news:
https://toolset.com/blog/

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