Filters the map settings
| Version | Description |
|---|---|
| 4.6 | Introduced |
Add a prefix to the map name
add_filter('mmp_map_settings', 'mmp_add_map_name_prefix');
function mmp_add_map_name_prefix($settings) {
$settings['name'] = 'This map is called: ' . $settings['name'];
return $settings;
}
Filters the map settings for a specific map
| Version | Description |
|---|---|
| 4.6 | Introduced |
Turn the name for the map with ID 1 into a link
add_filter('mmp_map_1_settings', 'mmp_add_link_to_map_1_name');
function mmp_add_link_to_map_1_name($settings) {
$settings['name'] = '<a href="https://www.example.com">' . $settings['name'] . '</a>';
return $settings;
}
Filters the map markers
| Version | Description |
|---|---|
| 4.11 | Introduced |
Hide the edit links for logged-in users
add_filter('mmp_map_markers', 'mmp_hide_marker_edit_links');
function mmp_hide_marker_edit_links($markers) {
foreach ($markers as $key => $marker) {
$markers[$key]['edit'] = false;
}
return $markers;
}
Filters the map markers for a specific map
| Version | Description |
|---|---|
| 4.11 | Introduced |
Remove popups on the map with ID 1
add_filter('mmp_map_1_markers', 'mmp_remove_popups_on_map_1');
function mmp_remove_popups_on_map_1($markers) {
foreach ($markers as $key => $marker) {
$markers[$key]['popup'] = false;
}
return $markers;
}
Filters the popup content
| Version | Description |
|---|---|
| 4.0 | Introduced |
| 4.18 | $marker parameter added |
Replace placeholders in format {{placeholder}} with dynamic content
add_filter('mmp_popup', 'mmp_replace_popup_placeholders');
function mmp_replace_popup_placeholders($popup) {
$popup = str_replace('{{weekday}}', date('l'), $popup);
$popup = str_replace('{{time}}', date('g:i a'), $popup);
return $popup;
}
This would turn a popup with content Today is {{weekday}} and it is {{time}} into something like Today is Monday and it is 5:16 pm
Dynamically add marker data to the popup
add_filter('mmp_popup', 'mmp_add_marker_data_to_popup', 10, 2);
function mmp_add_marker_data_to_popup($popup, $marker) {
$popup .= "<p>The coordinates for {$marker->name} are {$marker->lat}, {$marker->lng}</p>";
return $popup;
}
This would add something like The coordinates for Central Park are 40.782222, -73.965278 to the end of the popup
Filters the marker settings (currently only used when adding or editing a marker)
| Version | Description |
|---|---|
| 4.11 | Introduced |
Filters the marker settings for a specific marker (currently only used when adding or editing a marker)
| Version | Description |
|---|---|
| 4.11 | Introduced |
Filters the map strings
| Version | Description |
|---|---|
| 4.26 | Introduced |
Change the placeholder text for the search in the list of markers
add_filter('mmp_l10n_map_strings', 'mmp_change_search_placeholder');
function mmp_change_search_placeholder($map_strings) {
$map_strings['list']['search'] = 'Search stores';
return $map_strings;
}
Subscribe to our newsletter to not miss any news - you can unsubscribe at any time: