- This topic has 1 reply, 2 voices, and was last updated 6 years, 9 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Custom `posts_orderby` for a list of people
Hi,
Please can you advise on how I might use this custom posts_orderby function to order the results on page load, and when it is searched and filtered (via AJAX)
`
function posts_orderby_lastname ($query) {
$orderby_statement = “RIGHT(post_title, LOCATE(‘ ‘, REVERSE(post_title)) – 1) ASC”;
return $orderby_statement;
}
add_filter( ‘posts_orderby’ , ‘posts_orderby_lastname’ );
`
Is there anyway to modify the order of the id’s that are stored in cache for the results?
You want this to be applied at all times to the search results page? If so, you wil need to use this filter:
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
and add an orderby condition. The code goes in to the child theme functions.php file.