Forums › Forums › Search & Filter Pro › Order by 3 x fields
- This topic has 5 replies, 2 voices, and was last updated 4 years, 8 months ago by Anonymous.
-
Anonymous(Private) March 17, 2020 at 11:57 am #236913
Hi guys,
I hope you’re well and coping ok under these crazy times at the moment!!
I just have a quick query, we have around 20 search and filter forms which are ordered by 2 x custom fields, so that’s great we can set that up via the settings, but sadly we now need to order by a third field, how can we best achieve that?
Thanks ever so much,
TonyaTrevor(Private) March 17, 2020 at 12:37 pm #236926You would need to return the form order settings to default and instead use this filter:
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
Adding an orderby argument to the query. This search may yield some snippets:
https://support.searchandfilter.com/forums/search/orderby+sf_edit_query_args/
Anonymous(Private) March 18, 2020 at 1:29 pm #237067Hello again Trevor,
Sorry just a quick query as our client has asked this, when we are ordering by the 2 x different custom search fields we have set, please can I check what is then default ordering within that, ie say we are ordering by:
Urgent
PriorityIs it then by title within? So first all ‘urgent’ entries in alphabetical order by title, then all ‘priority’ entries in alphabetical order by title? Or is it some other field?
And either way, is there any way to override that default order to order by date as a global setting?
Thanks ever so much,
TonyaTrevor(Private) March 18, 2020 at 4:06 pm #237088The default order used by WordPress (and thus our plugin) is by Post Date descending (newest first).
There are plugins that can alter this, but using them is likely to break the sort order you set in our plugin, and possible break the search entirely.
As I said before, the only way to do this is using the filter I referenced.
-
AuthorPosts