Sort search result by time
Hi,
I'm trying to change the order of my ads when someone makes a search but there seems to be a problem when adding the filter. I want to order the ads by time when someone makes a search but instead I get no results found. The WordPress search has a parameter, orderby, which you can set directly in the URL and then it will order by that parameter but I'm interested in making this default with a filter. Is this possible?
This is my current filter that returns no results found:
PHP Code:
add_filter('posts_orderby', 'new_order' );
function new_order( $orderby ){
global $wpdb;
if(is_search()){
$orderby = "time";
}
return $orderby;
}
Is the parameter maybe called something else in classipress or should I not even use the posts_orderby?
Thx in advance!