wpgmp_route_tab - WP Maps Pro

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

wpgmp_route_tab

The wpgmp_route_tab hook in the WP Maps Pro plugin allows developers to customize the functionality of the route tab settings at runtime. It is triggered when the route tab settings need to be modified, providing flexibility to change how routes are displayed or managed in the plugin.

Usage

Developers can implement this hook within their WordPress themes or plugins to modify route tab settings. It is particularly useful for those who want to customize the appearance or behavior of routes in their WP Maps Pro setup. A practical tip is to ensure that any modifications do not conflict with other functionalities of the plugin.

Example 1

Description: Customize the title of the route tab to display a custom name.

add_filter('wpgmp_route_tab', 'custom_route_tab_title', 10, 2);
function custom_route_tab_title($route_tab, $map) {
    $route_tab['route_tab_title'] = 'Custom Routes';
    return $route_tab;
}

Example 2

Description: Disable the display of the route tab by setting the display parameter to 0.

add_filter('wpgmp_route_tab', 'disable_route_tab_display', 10, 2);
function disable_route_tab_display($route_tab, $map) {
    $route_tab['display_route_tab'] = 0;
    return $route_tab;
}

Example 3

Description: Change the travel mode of a specific route to “BICYCLING”.

add_filter('wpgmp_route_tab', 'change_route_travel_mode', 10, 2);
function change_route_travel_mode($route_tab, $map) {
    foreach ($route_tab['route_tab_data'] as &$route) {
        if ($route['route_id'] == 14) {
            $route['route_travel_mode'] = 'BICYCLING';
        }
    }
    return $route_tab;
}

Tip: When using this hook, always backup your site and test changes in a staging environment to prevent any potential conflicts or unexpected behavior.

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.