Using the Locations Map Shortcode
It is possible to create a map with pins from specific Locations in the database. We do this by using a WordPress shortcode, which looks like this:
The shortcode requires 3 things to work:
- The name “locations-map,” as shown above.
- Include: A comma-separated list of Location IDs include in the map.
- Exclude: A comma-separated list of Location IDs exclude from the map.
- Each Location included must have a pin set on the “GPS Settings” field, or else it will not be displayed.
If neither include or exclude are set, the map will display all Locations that have GPS data.
How to Find the Location ID
There is an ID column on the Locations Edit Screen in the WordPress Admin. Find the Location you’re trying to include, and copy the ID from there.
I’ve copied the IDs for Kiwanis and Rotary park, and included the shortcode below. If you’re viewing the front-end of the website, you should see a map with pins for each location.