Hi
Is it possible to change the label of the default order on a sort dropdown box?
As right now I can give nice labels to custom order options for the dropdown but the default order it just writes "Field - FIELDNAME" which looks really messy and confusing to the end user.
Thanks!
Hi,
Thank you for contacting us and I'd be happy to assist.
Whether you're using the blocks editor or the classic editor for the view, you can change the label for the default sorting option.
In the case of the blocks based view, you can add a sorting option for the same field that is being used for the default ordering, and then you'll be able to change its label, as shown in the screenshot "sorting-options-blocks.png".
And if you're using the classic view, you can add a label, when adding the sorting control, as shown in the screenshot "sorting-options-classic.png".
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
Ah brilliant thanks for that.
Also there seems to be no way to set secondary sort options when using the sort options for users? I want to be able to show posts that have "featured" enabled to show first. I can do this on my default sorting options with having this as the first sorting option and then secondary is alphabetical.
Then for another option I want to still show featured first but then secondary sort by a custom field.
How could I do this with the custom sorting options for users though? So featured still show first?
Thanks.
Thanks for writing back.
Your observation is correct and secondary sorting doesn't work with the front-end user sorting.
I'm not sure exactly what you meant from "featured" criteria, but, you can use the "wpv_filter_query" to customize the view's query to include secondary sorting in that case:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
You'll first closely examine the view's query structure when primary and secondary sorting is set, without any front-end sorting. Next, you can customize it to have the same structure, when using the front-end sorting.
Another workaround can be to use two identical views on the page, with the first showing only the featured results and the other only the non-featured ones.
As long as the sorting controls and custom search filters (if any), both are set to show results without AJAX (i.e. with the page reload), both the views should stay in-sync.
Right OK, not massively following to be honest but I am starting to think I will need to use API and its quite advanced? Not an issue I can get help from a Toolset contractor I have used from here previously.
However if you could help me to better understand so I can explain to them that'd be much appreciated.
I don't wish to use 2 views, I would rather keep to 1 view for management ease.
So to better explain I have a custom field lets called it "wpcf-featured", this is a check box. If its checked then currently these show first, then the rest of the results alphabetically.
What id like to do is if I order the posts by amount for example then it shows the check boxed featured ones first still then the posts by amount.
Is this feasible using "wpv_filter_query" you mentioned? What am I specifically looking for here someone to customise the default Toolset sorting controls or to basically build a custom one using the toolset API?
Thanks!
Thank you for sharing these details.
I'll need to perform some tests over the weekend to share some more pointers.
This will take some time, but, I'll try my best to come up with something by the start of the next week.
OK great thank you Waqar, appreciate that. 🙂
No rush.
Matt
Hi Matt,
Just wanted to let you know that we had an unusually busy queue over the weekend, but, I'll be able to follow up on this within a day or two.
Thank you for your patience.
regards,
Waqar
Thank you for waiting Matt.
I've done some tests over the weekend but unfortunately couldn't make this two-level sorting work.
If you absolutely need this feature, you can consult with Toolset contractors to see if they have some more ideas or have accomplished something similar in the past:
https://toolset.com/contractors/
I apologize, I couldn't prove more useful in this case.