Filter reference

Maps

mmp_map_settings

Filters the map settings


Parameters

$settings
(array) Multidimensional array of map settings

Changelog

Version Description
4.6 Introduced

Examples

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;
}

mmp_map_{$id}_settings

Filters the map settings for a specific map


Parameters

$settings
(array) Multidimensional array of map settings

Changelog

Version Description
4.6 Introduced

Examples

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;
}

mmp_map_markers

Filters the map markers


Parameters

$markers
(array) Multidimensional array of map markers

Changelog

Version Description
4.11 Introduced

Examples

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;
}

mmp_map_{$id}_markers

Filters the map markers for a specific map


Parameters

$markers
(array) Multidimensional array of map markers

Changelog

Version Description
4.11 Introduced

Examples

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'] = '';
    }

    return $markers;
}

Markers

mmp_popup

Filters the popup content


Parameters

$popup
(string) Popup content

Changelog

Version Description
4.0 Introduced

Examples

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

mmp_marker_settings

Filters the marker settings (currently only used when adding or editing a marker)


Parameters

$settings
(array) Multidimensional array of marker settings

Changelog

Version Description
4.11 Introduced

mmp_marker_{$id}_settings

Filters the marker settings for a specific marker (currently only used when adding or editing a marker)


Parameters

$settings
(array) Multidimensional array of marker settings

Changelog

Version Description
4.11 Introduced
0
0
84
Rate this reference

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

en English
X