Hi 🙂
Is it possible to setup a default option there when creating a custom search?
Thank you.
Hello,
Thank you for getting in touch.
Yes there is. Are you using the classic view or was your view created with the block editor. Also is there a frontend sort filter on your site ?
Please let me know.
Thanks,
Shane
This seems to be complicated?
classic view.
what do you mean with fsf?
Hello,
No it is not complicated because there is an order option on the view. If you go to your views edit page and scroll to "Ordering", you should be able to set the ordering option of your view here. See Screenshot.
Please let me know if this helps.
Thanks,
Shane
Ah yes, that´s clear. Thank you.
BUT
I have a custom search that will be sorted first by rating and then by post date (second criteria)
But in the search form, users can choose to sort by rating or another field in the post.
That works quite smoothly, BUT:
When calling the search now, no sort criteria in the form is marked initially and I have to set the sorting by jquery, what results in some delay and confusion. So I would like to tell the search in that case how to sort results, maybe by url parameter?
SORRY for having been unclear.
Hello,
Thank you for the clarity. The URL parameter can be used I believe and you're making reference to when the view has no search criteria correct?
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-154377
If you look here you can see that the view has an orderby parameter. What i'm not sure is if this can accept a shortcode, however you can try doing the following.
[wpv-view name='myview' orderby="[wpv-search-term param='my-url-param']" order="asc"]
Where myview is the slug of the view and my-url-param is the URL parameter of the view. This is where you can provide the custom field value in the URL prefixed by "field-" as per the documentation.
Thanks,
Shane