Links

Google Map

Display the Google Map field without additional JavaScript code.
To make use of the Google Map field you’ll need to define the Google Map API key in your theme.
Copy the code snippet below into your theme’s functions.php file, replacing the ‘YOUR_KEY_HERE’ with your API key. Get Google Maps API key here.
// Google Map API key
add_filter('acf/fields/google_map/api', function ($apiSettings) {
return array_merge($apiSettings, [
'key' => 'YOUR_KEY_HERE',
]);
});
Tip: Change the height of the Google Map, visit the field group in ACF and define the ‘Height’ in px. Alternatively, define the height using CSS by copying the snippet below into your View CSS Code field in the “Advanced” tab.
/* Define the height of the Google Map */
#views__map {
height:600px;
}

Field Options (Pro)

Hide Google Map - The Google Map is shown by default. Turn on the switcher to hide the map.
Map address format - By Default the address format is street number, street name, city, state, post code and country. You can change the order or hide some parts by using the provided variables.
$street_number$, $street_name$, $city$, $state$, $post_code$, $country$
If the Map address format field is left empty, then no address is shown.
Last modified 8d ago