Hi Daniel,
Thank you for sharing these details.
During testing on my test websites, I was able to block the loading of Toolset maps through the "Scripts Center" setting.
( example screenshot: lien caché )
This worked in single as well as in the multisite environment, however, you'll need to add this setting for each site in the network individually.
Another option that worked for me was using the "Consent API" method, that the plugin author mentioned.
I installed the plugin downloaded from the plugin's page ( lien caché ) and added a custom shortcode, that checks whether the consent for the cookie has been granted or not.
Example:
add_shortcode('check_for_cookie_consent', 'check_for_cookie_consent_fn');
function check_for_cookie_consent_fn($atts) {
$a = shortcode_atts( array(
'type' => '',
), $atts );
if (wp_has_consent($a['type'])){
return 'yes';
}
else
{
return 'no';
}
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
Note: Please also add "check_for_cookie_consent" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
After that, this shortcode can be used in the content like this:
[check_for_cookie_consent type='functional']
The above shortcode will return 'no' if the "functional" category consent is blocked and 'yes' if it is not set or allowed.
( ref: lien caché )
To only show a map, when functional consent is allowed or not blocked, the same shortcode can be used in conditional output blocks, to wrap the map's shortcode like this:
( ref: https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/ )
[wpv-conditional if="( '[check_for_cookie_consent type='functional']' eq 'yes' )"]
[wpv-map-render map_id="map-1"][/wpv-map-render]
[/wpv-conditional]
[wpv-conditional if="( '[check_for_cookie_consent type='functional']' ne 'yes' )"]
You'll need to allow a functional cookie, to view the map!
[/wpv-conditional]
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar