<?php
/**
* The Events Calendar and/or PRO: Set Region and Language biasing for Google Maps.
*
* @link https://gist.github.com/cliffordp/c7c2713e9f61166e9aef746823be6bfa This snippet.
* @link https://developers.google.com/maps/faq#languagesupport Language Codes.
* @link https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingRegionCodes Region codes.
*
* @param string $api_url The Google Maps API URL.
*
* @return string
*/
function tribe_add_google_map_region( $api_url ) {
if ( ! empty( $api_url ) ) {
// !!! TODO: change these as required for your language and location. This is set to Australia!!!
$api_url = add_query_arg( [
'language' => 'en-Au', // English (Australian)
'region' => 'AU', // Australia
], $api_url );
}
return $api_url;
}
// Google Maps for The Events Calendar (such as Single Event page's venue location map)
add_filter( 'tribe_events_google_maps_api', 'tribe_add_google_map_region' );
// Google Maps for Events Calendar PRO's (such as geolocation and Map View)
add_filter( 'tribe_events_pro_google_maps_api', 'tribe_add_google_map_region' );