This hook in WP Maps Pro allows developers to customize the functionality of map overlays at runtime. It is used to modify the overlay settings of a map, such as border color, width, height, font size, border width, and border style.
Usage
Developers can implement this hook in their theme’s functions.php file or in a custom plugin to modify the overlay settings of maps provided by the WP Maps Pro plugin. By using this hook, you can dynamically change how map overlays are displayed based on specific conditions or requirements.
Example 1
This example demonstrates how to change the border color of the map overlay to blue.
add_filter('wpgmp_map_overlays', 'customize_map_overlay_border_color', 10, 2); function customize_map_overlay_border_color($overlay_settings, $map) { $overlay_settings['border_color'] = '#0000ff'; // Change border color to blue return $overlay_settings; }
Example 2
In this example, the border style of the map overlay is changed to solid.
add_filter('wpgmp_map_overlays', 'customize_map_overlay_border_style', 10, 2); function customize_map_overlay_border_style($overlay_settings, $map) { $overlay_settings['border_style'] = 'solid'; // Change border style to solid return $overlay_settings; }
Example 3
This example shows how to increase the font size of the map overlay text.
add_filter('wpgmp_map_overlays', 'customize_map_overlay_font_size', 10, 2); function customize_map_overlay_font_size($overlay_settings, $map) { $overlay_settings['font_size'] = '18'; // Increase font size return $overlay_settings; }
Tip: Always validate and sanitize your inputs when modifying overlay settings to ensure the security and stability of your WordPress site.