Tell us what you are trying to do?
We're trying to sort the values of the Custom Search Filter Field
Is there any documentation that you are following?
Nope, we couldn't see more documentation on how the "Order of the options" works.
Is there a similar example that we can see?
See here: enlace oculto
What is the link to your site?
Here: enlace oculto
HI Loan,
Thank you for getting in touch.
I don't believe we have any additional documentation on thi.
However is the issue that your field is being sorted?
Please let me know.
Thanks,
Shane
Hi,
The issue is still not resolved.
We need to know how this sorting option of the Custom Search Filter Field works so we can know how to approach this.
Hi,
Just to add.
We're trying to sort the value of this Search filter to Publish Date.
The values are coming from Custom Post Type (Physician).
Hello,
Not sure I understand the issue fully, however the ordering option on the filter should sort it based on the value of the filter.
In your case I see that your filter values are texts.
Can you let me know what kind of field this is ? Meaning the field that was created in our Toolset Types plugin.
Thanks,
Shane
Hi,
This is a Single line field, see here: enlace oculto
What we are trying to do is to sort the field values from the post dates. Currently, this custom field is connected to a custom post type and we want to know if there is code that can sort the field values via post date.
If you go to this page: enlace oculto the post are being sorted via post date and we want the search field to do the same thing. (enlace oculto)
Are you able to help?
Hello,
Ok thank you for the clarity.
Unfortunately no you are not able to sort the post field itself by the post date. Reason being the sorting is done based on attributes of the field and not attributes of the post that it i connected to.
Of course this can be done with some custom code to curate the field terms but this would be out of the scope of what we can provide as support.
Thanks,
Shane
Hi Shane,
How about changing the Search Filter Field value from a custom field to Post Title or any relevant that we can sort the values via post date?
Any help would really appriciated.
Let us know. Thanks!
Best,
Paul
Hi Paul,
How about changing the Search Filter Field value from a custom field to Post Title or any relevant that we can sort the values via post date?
Unfortunately this still not work because as mentioned the fields are sorted by an attribute of the field, in this case the field is sorted by its value. Whatever the value is of that field this is what it will be sorted by.
Thanks,
Shane
Hi Shane,
Is there any chance that we can change the attribute to post titles? or maybe do you have any other methods to help us achieve our goal?
Let us know. Thanks!
Hi Loan,
Unfortunately no, the only thing I can think of is the use of taxonomies and then add a custom field to the taxonomy terms which will determine the order you want them to be retrieved by.
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_frontend_search_get_terms_args
The function above is basically a wrapper function for.
https://developer.wordpress.org/reference/functions/get_terms/
Where the same arguments that you provide here can be used in the view filter function. This takes a bit of setup as you will need to setup the taxonomies as well as setup the numeric value of each taxonomy term so that they can be sorted correctly.
Please let me know if this helps.
Thanks,
Shane
Hi Shane,
Thus using taxonomy requires using custom coding or will just use search filter field?
Best,
Paul
Hi Paul,
Using taxonomies will allow you to generate the dropdown filters however with the hook that I sent you should be able to customize how the items are displayed. Meaning you should be able to sort the terms by a term meta value.
Thanks,
Shane