Title Ascending order only for category pages
- priyanka_kethireddyParticipant7 months, 2 weeks ago #33085
Hello Team,
We have a requirement like to add a sort of ‘title ascending’ but it should not show on search page only for category pages which we are showing data using solr. Is there any action we can show particular sort only for category pages.Thanks in advance.
wpsolrKeymaster7 months, 2 weeks ago #33087You can use this hook:
use wpsolr\core\classes\WPSOLR_Events; add_filter( WPSOLR_Events::WPSOLR_FILTER_SORT_FIELDS, 'wpsolr_filter_sort_fields', 10, 1 ); public function wpsolr_filter_sort_fields($default_sort_fields) { // If current page is a category, then modify default_sort_fields (...) return $default_sort_fields; // array of field names }
priyanka_kethireddyParticipant7 months, 1 week ago #33139Thank you, we will try this way.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.