This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Implement a sorting dropdown

#55592
Ernest MarcinkoErnest Marcinko
Keymaster

On the search results page it is actually possible without any additional code, as it will recognize the $_GET['order'] and $_GET['orderby'] parameters.

All you need to do is append that to the end of URL as query parameters, like: ...&order=ASC&orderby=id

The possible supported values by default are:
order parameter: ASC, DESC
orderby parameter: id, post_id, product_id, popularity, post_popularity, product_popularity, rating, post_rating, product_rating, date, post_date, product_date, name, post_name, alphabetical, price, relevance

I suggest using these if you can. If you want you can custom code additional accepted values as you like, let me know and I will let you know a custom code snippet.