Plugin Author
TC.K
(@wp_dummy)
You can configure the order setting in the form setting page -> Result Page Settings.
I also use the ajax method with a custom result layout.
But when I change the Orderby at the Result Page Settings nothing happens. It keeps showing the oldest post first. Ascending and Descending also does not change anything.
Thread Starter
serks
(@serks)
Yes, I can also verify that using the settings in the form settings page does not work.
Both orderby and ascending/descending settings have no effect.
I had already tried those settings before I created this topic but I just assumed that these settings were only for the default search template and not for ajax which is why I didn’t mention it earlier.
Any other ideas?
Thanks for quick response.
Thread Starter
serks
(@serks)
Ok I have found my problem…
I was using the following code on my site to reorder the custom post type in my admin.
add_filter("posts_orderby", "reorder_cpt", 10, 2);
function reorder_cpt($orderby, &$query){
global $wpdb;
//figure out whether you want to change the order
if (get_query_var("post_type") == "custom_post_type") {
return "$wpdb->posts.post_title ASC";
}
return $orderby;
}
Turns out it was messing with the entire site and not just the admin listings.
I can now confirm that changing the order settings in the Results Page Settings of the WPQSF form does indeed work as it should.
Yasp0, take a look to see if you have any other functions elsewhere in your code that could be messing with the query’s order.
Thanks
Thanks, also found my problem 🙂
I had a query for an advanced search in the functions.php which caused it.