wpgmp_direction_tab - WP Maps Pro

15000+ live websites are using this google maps wordpress plugin.

wpgmp_direction_tab

This hook in WP Maps Pro allows developers to customize the directions tab settings at runtime. It is triggered when there is a need to modify the settings related to the directions tab in a map instance.

Usage

Developers can implement this hook to alter the appearance and functionality of the directions tab in WP Maps Pro. It is typically used in the theme’s functions.php file or a custom plugin, allowing for dynamic changes based on specific conditions or preferences.

Example 1

Modify the title of the directions tab.

add_filter('wpgmp_direction_tab', function($direction_tab, $map) {
    $direction_tab['direction_tab_title'] = 'Custom Directions Title';
    return $direction_tab;
}, 10, 2);

Example 2

Disable markers in the directions tab for a specific map.

add_filter('wpgmp_direction_tab', function($direction_tab, $map) {
    if($map->ID == 123) { // assuming 123 is the map ID
        $direction_tab['suppress_markers'] = 0;
    }
    return $direction_tab;
}, 10, 2);

Example 3

Enable the directions tab only for logged-in users.

add_filter('wpgmp_direction_tab', function($direction_tab, $map) {
    if(!is_user_logged_in()) {
        $direction_tab['dir_tab'] = 0;
    }
    return $direction_tab;
}, 10, 2);

Always ensure that any custom code implementing hooks is thoroughly tested in a staging environment before deploying to a live site to prevent any unexpected behavior or site downtime.

Install Plugin Now!

Buy this plugin exclusively on CodeCanyon! You’ll get free updates, full support, and if you’re not satisfied, we’ve got you covered with a 30-day money-back guarantee.