Hi,
Thank you for contacting us and I'd be happy to assist.
As you noted, the way "wpv-geolocation" shortcode works, it shows the user location consent and if it is granted, saves the location cordinates in browser's cookie ( key: toolset_maps_location ) and then reloads the page, so that any content that was enclosed within this shortcode can be properly rendered.
I'm afraid, there is no built-in and/or simper way to bypass this page re-load but you can use a following workaround to speed things up:
1. Instead of asking for user location consent on the actual page which may be slow due to other content, you can create a new page named for example "User location consent" just for this purpose.
This page will only have the code for user's location consent, so it should be quicker than loading the actual page.
2. You can register a new custom shortcode, that redirect to a specified page using the "id" attribute:
add_shortcode('custom-safe-redirect', 'custom_safe_redirect_func');
function custom_safe_redirect_func($atts) {
$a = shortcode_atts( array(
'id' => '',
), $atts );
$url = get_permalink($a['id']);
if ($url) {
ob_start();
echo '<script type="text/javascript">';
echo 'window.location.href="'.$url.'";';
echo '</script>';
return ob_get_clean();
}
}
3. On this new "User location consent" page, you'll add this custom shortcode, wrapped in "wpv-geolocation" shortcode:
[wpv-geolocation message_when_missing="We need your location to show this content"]
[custom-safe-redirect id="123"]
[/wpv-geolocation]
Note: you'll replace 123 with the actula ID of the page, that holds the view that is for "user location allowed" case.
When a user will visit this new page, he/she will see a user location consent, and only if it is allowed, will be automatically redirected to the view for the user location allowed case.
For the other case, you can include a link to a page that holds the view that is to be used when user doesn't allow location access, below the "[wpv-geolocation]" shortcode.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar