I am trying to add a ordering / sortering button in my Archive Cell.
I visited this URL: https://toolset.com/forums/topic/sorting-views-output-by-custom-fields-date-and-more/
But since the questions is 3 years old, I guess there are some new solutions at this problem.
I would like to add a sorting button for post-title, post-date and date. Meaning a possibility to have DESC and ASC for each option.
This is the code I have found from the question above, but I can't get it to work.
<select name="wpv_column_sort_id">
<option value="post-title">Title</option>
<option value="post-date">Date</option>
</select>
Any ideas where I can find the code I am looking for?
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Ole,
Thank you for contacting our support forum.
What you are referring to is a frontend sort that customer can select on the frontend how they want the data to be sorted correct?
Currently the only way to do this is by creating a view and displaying the data in a Table format and then enabling sortable columns on that table.
This way the table can be sorted by the headers.
Any other method would require that you write some custom code.
Thanks,
Shane
Hello Shane,
Thank you for helping me out,
I am referring to a frontend sort that customer can select on the frontend how they want the data to be sorted, that is correct.
The archive page is getting complicated and have used hours developing this part. So I would be happy if the problem could be solved by writing some custom code. Do you have any example of custom code that can be written?
My page can be found here if interested: hidden link
The page takes a long time to load, but I will open a separate question for that when time comes.
Looking forward to hear from you again,
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Ole,
Unfortunately not.
You will need to write some custom code in order for this to work.
Our plugin doesn't have a way to perform frontend sorting.
Thanks,
Shane