Tell us what you are trying to do?
I would like to show all the schools (We have the address of all the school which is a product) which is in the radius of 30kms from the address of the currently logged in user. I have the address of the currently logged in user in the custom map field of user as "landmark".
There is no such native option but I try to add the following code to "Custom Code" section of Toolset:
add_filter( 'wpv_filter_query', 'func_distance_filter_landmark', 99, 3 );
function func_distance_filter_landmark( $query_args, $view_settings, $views_id ) {
if ( $views_id == 1535 ) { // if it is specific view and by default
$x = do_shortcode('[wpv-attribute name="landmark"]');
$view_settings['distance_order']['center'] = $x;
}
return $query_args;
}
Where we are grabbing the landmark shortcode attribute we pass to view and grab the value and assigning to distance order's center dynamically. Dose this works?