Skip to main content

Google Maps

Events Manager can draw a Google map wherever a physical location is shown. Maps are optional: locations, addresses and location pages all work without them.

Google bills for map usage

Google Maps needs a Google Cloud account with billing set up, and Google charges for use beyond its free allowances. Before switching maps on for a busy site, read Google Maps API Usage to see what is counted and how to keep it down.

Where maps appear​

PlaceWhat draws it
Location pages and event pagesThe #_LOCATIONMAP placeholder, which is part of the default single location and single event formats
A page of your choice, with a marker for every locationThe [locations_map] and [events_map] shortcodes, and the Map view of the search form
The location editor and the Where box of the event editorA preview that finds the address as you type. Drag its marker to set the exact spot.
The search formThe Near... field, which suggests places as the visitor types and then finds events within a distance of the one they choose

Set up maps​

  1. Create a Google Maps API key and enable the APIs Events Manager uses. Setting Up Google Maps API Keys and Libraries lists which ones you need.

  2. Go to Events then Settings then General then Google Maps and Location Services.

  3. Set Enable Google Maps integration? to Yes and paste the key into Google Maps API Browser Key.

  4. Choose a Google Map Type. Dynamic is the interactive map. Google Map Types compares it with the others.

  5. Click Save Changes, then open a location in Events then Locations. A map should appear beside the address.

The key field is blank here. Yours holds your browser key.

Locations created while maps were off have no coordinates yet. Open each one in the editor: Events Manager looks the address up, tells you the map and coordinates have been updated, and asks you to save the location again.

Settings​

All in Events then Settings then General then Google Maps and Location Services.

SettingWhat it does
Enable Google Maps integration?Turns every map on or off, in wp-admin and on the front end. On for new sites. With it off, #_LOCATIONMAP prints nothing.
Google Maps API Browser KeyYour key. Google rejects map requests without one. Restrict it to your site, as described in the key setup.
Google Map TypeDynamic or Embedded. Events Manager Pro adds Static. See Google Map Types.
Embed Display TypeFor embedded maps, what Google builds the map from: Location name and address, Address only or Location coordinates.
Google Maps StyleA JSON style for dynamic and static maps. See Map styling.

With Pro and the Static map type selected, a Static Map Options group appears below these. It is covered in Google Static Maps.

Size and balloon text​

Events then Settings then Formatting then Maps sets how maps look inside your pages.

SettingDefaultWhat it does
Default map width400pxWidth of maps drawn by #_LOCATIONMAP. Pixels or a percentage, such as 100%.
Default map height300pxHeight, in the same units.
Override Default Formats?NoSet to Yes to edit the two balloon formats below.
Location balloon format (under Global Map Format)The text in the balloon when a visitor clicks a marker on a [locations_map] or [events_map] map.
Location balloon format (under Single Location/Event Map Format)The text in the balloon on a #_LOCATIONMAP map.

To size one map differently, give the placeholder a width and a height: #_LOCATIONMAP{100%,250px}. The shortcodes take width and height attributes.

Balloons belong to dynamic maps. Embedded and static maps don't have them.

Map styling​

Paste a JSON style into Google Maps Style (in the settings box above, on the General tab) to recolor your maps. You can build one with the Google Maps Styling Wizard or copy one from Snazzy Maps.

  • The style applies to dynamic maps and to Pro's static maps. Embedded maps can't be styled.
  • The preview in the location and event editors is left unstyled so the marker stays clear to place.

A map made with the [locations_map] or [events_map] shortcode can have a style of its own. Encode the JSON as base64 (any online base64 encoder will do) and pass it in the map_style attribute:

[locations_map width="100%" map_style="Ww0KICB7DQogIC...ogIH0NCl0="]

Troubleshooting​

The map area shows an error, or stays gray

Google refused the request. The usual causes, in order:

  1. No key, or a mistyped key, in Google Maps API Browser Key.
  2. An API the map needs isn't enabled on your Google Cloud project, or the project has no billing account. See the list of APIs.
  3. The key's website restriction doesn't match your site's address. Test with the restriction removed, then put it back with the right pattern.

Your browser's developer console names the exact Google error.

Maps worked until another plugin or theme was activated

Only one copy of the Google Maps library can load on a page. If a theme or another plugin loads it first, Events Manager uses that copy, with whatever key (or none) it was loaded with. Enter the same API key in that theme or plugin's own settings. To confirm the cause, test with a default theme and other plugins deactivated.

"Loading Map...." never goes away

A JavaScript error on the page is stopping the map script, usually from the theme or another plugin. Check the browser console for the first error listed. A theme that leaves out the standard wp_head() and wp_footer() calls has the same effect, because the scripts never reach the page.

The page says "Map Unavailable"

The location has no coordinates. Open it in Events then Locations, check that the map finds the address, and save.

The editor says "Location not found", or the marker is in the wrong place

Events Manager sends the address, town, state, postcode and country to Google as one line. If Google can't place it, try the same line on maps.google.com and adjust the address until it is found, or drag the marker to the right spot and save.

Next steps​