Thread Starter
Houdini
(@romariokg)
Hi, I found that sorting when navigating by taxomies rtcl_category and rtcl_location does not work correctly due to the Classified Listing Store 2.0.0 plugin.
If I disable the Classified Listing Store plugin, sorting starts working normally from the user settings, I did not find the reason for this behavior. I recommend you to check it.
Thread Starter
Houdini
(@romariokg)
To solve this problem I had to use the following code in the functions.php file
## Force sorting of records (tasks) in descending order (DESC)
function force_rtcl_listing_order( $query ) {
if ( ! is_admin() && $query->is_main_query() && (
// is_post_type_archive( 'rtcl_listing' ) ||
is_tax( 'rtcl_category' ) ||
is_tax( 'rtcl_location' ) // Taxonomies rtcl_category and rtcl_location
)) {
$query->set( 'orderby', 'date' ); // Can be replaced with 'title', 'meta_value'.
$query->set( 'order', 'DESC' ); // Force DESC
}
}
add_action( 'pre_get_posts', 'force_rtcl_listing_order' );
My problem is solved, but it is worth paying attention to.
Hi,
Thanks for identifying the issue specifically, will fix the conflict with store plugin.
Thank you
Hi,
Could you share your settings and search results screenshot?
I see, it’s okay here and also activated store plugin https://prnt.sc/X81awwlJqFpC https://prnt.sc/dRz34DNpcA6F https://prnt.sc/KHUiXeR6iEzZ
Thank you
Thread Starter
Houdini
(@romariokg)
Hi, I forgot to write to you! It seems to be a code conflict in my theme, because I added my own functions.
My problem is solved with the code above!
You can ignore this problem if other users do not write about it.
I’m sorry! Please forgive me!
Thanks!
-
This reply was modified 1 year ago by
Houdini.
-
This reply was modified 1 year ago by
Houdini.