Last active
May 30, 2018 22:50
-
-
Save cliffordp/9d6c25feb389f98e8ae09a41273a3488 to your computer and use it in GitHub Desktop.
Override Google Maps API call URI and add Google Maps API Key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The Events Calendar: Override Google Maps API call URI, such as to include | |
* additional libraries (e.g. drawing, geometry, places, visualization). | |
* | |
* @link https://gist.github.com/cliffordp/9d6c25feb389f98e8ae09a41273a3488 | |
* @link https://developers.google.com/maps/documentation/javascript/libraries | |
* | |
* @see add_query_arg() | |
* @see esc_url_raw() | |
**/ | |
add_filter( 'tribe_events_google_maps_api', 'cliff_tec_modify_google_maps_uri' ); | |
add_filter( 'tribe_events_pro_google_maps_api', 'cliff_tec_modify_google_maps_uri' ); | |
function cliff_tec_modify_google_maps_uri( $api_url ) { | |
$api_url = add_query_arg( 'libraries', 'drawing,geometry,places,visualization', $api_url ); | |
// esc_url() will break it so esc_url_raw() or don't escape at all | |
return esc_url_raw( $api_url ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment