Display locations listed alphabetically when the user loads the page and switch to sorting by distance only if they enter an address. It's caused a lot of issues not being able to set a default sort order and we get a lot of complaints.
Is there any documentation that you are following?
I tried using the following code to override the behaviour but didn't do anything at all.
add_filter('wpv_filter_query', 'customize_toolset_sorting', 99, 3);
function customize_toolset_sorting($query_args, $view_settings, $view_id) {
if ($view_id == '549') {
if (empty($_GET['toolset_maps_distance_center'])) {
// No location provided, sort alphabetically by title
$query_args['orderby'] = 'title';
$query_args['order'] = 'ASC';
} else {
// User provided a location, use default config
}
}
return $query_args;
}
Hello. Thank you for contacting the Toolset support.
Can you please share admin access details so I can check your current view settings and guide you accordingly.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
It seems you have set different settings for the view on staging site as well as live site as I can see the posts are order by title it self already on staging site. If both view settings are different, can you please set the view setting on your staging site as per your production site so I can see the same results.
I've also moved the "wpv_filter_query" code you added to functions.php file of your theme to "Custom Code" section offered by Toolset:
- hidden link
I had left the filter sorting alphabetically but I can't seem to get your code working on the website. I tried using both the view sorting by alpha and seeing if it would sort by location when a location was provided, then the reverse setting the default sort to by distance from the location and alpha. The code doesn't seem to have any effect.
I also tested it using AJAX which was the current setting and full page refresh to see if that might be the issue. Could you confirm the settings you had it working with?