[Pro] Using the Addon with ACF fields
If you want to populate the map with content from ACF, you’ll need to make sure your post type includes a field for either the region code (country name, country code or region code) or a field that stores coordinates, if you want to populate markers. These fields can be inside a repeater field.
Identifying Fields
When creating fields in ACF, they will have a unique ID that you’ll need to use when setting up the options in your map. You should refer to the Name column of your fields.
![[Pro] Using the Addon with ACF fields [Pro] Using the Addon with ACF fields](https://interactivegeomaps.com/wp-content/uploads/2021/10/acf_fields_list_name-1024x555.png)
Regions
If you plan to populate the map with countries or regions of a country, you should have an ACF field to identify that country or region.
The field can be an open text field, a select field or even a checkbox. The important thing is that the value of the field is either the correct name listed for the regions of the map you’ll use or that region code. For example, if you want to populate France, the value should be either France
or FR
. If you want to populate California in a USA map, the value should be California
or US-CA
.
Markers
To populate your map with markers, your post type must have fields for coordinates: latitude and longitude.
You can have an open text field for both of them, but a field that also works is the Google Maps field, that ACF provides. That field stores both latitude and longitude. If you use this field, you can use the same field id/name for both latitude and longitude fields, when setting up the map with the ACF options. The Addon will fetch the coordinates automatically from the Google Maps field value.
![[Pro] Using the Addon with ACF fields [Pro] Using the Addon with ACF fields](https://interactivegeomaps.com/wp-content/uploads/2021/10/la_lo_field.png)
If the Google Maps field is not working properly when using the same id in both fields, use this format instead:
location.lat
and location.lng
Repeater Fields
The fields mentioned above can be inside a repeater field. When creating/editing your map, you’ll just need to enable the ‘Use Repeater’ option and identify what is the ID/Name of the repeater field.
![[Pro] Using the Addon with ACF fields [Pro] Using the Addon with ACF fields](https://interactivegeomaps.com/wp-content/uploads/2021/10/acf_repeater_fields_map-1024x433.png)