Google Maps field type for CMB2.
Running an older version of CMB? Check the previous releases.
The pw_map
field stores the latitude/longitude values which you can then use to display a map in your theme.
You can install this field type as you would a WordPress plugin:
- Download the plugin
- Place the plugin folder in your
/wp-content/plugins/
directory - Activate the plugin in the Plugin dashboard
Alternatively, you can place the plugin folder in with your theme/plugin. After you call CMB:
require_once 'init.php';
Add another line to include the cmb-field-map.php
file. Something like:
require_once 'cmb_field_map/cmb-field-map.php';
pw_map
- Save a location on a map. Example:
array(
'name' => 'Location',
'desc' => 'Drag the marker to set the exact location',
'id' => $prefix . 'location',
'type' => 'pw_map',
'sanitization_cb' => 'pw_map_sanitise',
),