wpgmp_infowindow_message - WP Maps Pro

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

wpgmp_infowindow_message

The wpgmp_infowindow_message hook in WP Maps Pro allows developers to customize the content of the infowindow message dynamically. This hook is triggered when the infowindow message is being prepared for display, enabling developers to modify the message string using custom logic.

Usage

Developers can implement this hook by adding it to their theme’s functions.php file or in a custom plugin. It provides a way to alter the displayed infowindow message by applying custom filters, making it highly versatile for different use cases such as localization, adding dynamic content, or styling modifications.

Example 1

Description of the first use-case: Adding a prefix to the infowindow message to indicate special offers.

add_filter('wpgmp_infowindow_message', 'add_special_offer_prefix');
function add_special_offer_prefix($message) {
    return 'Special Offer: ' . $message;
}

Example 2

Description of the second use-case: Translating the infowindow message based on the user’s language preference.

add_filter('wpgmp_infowindow_message', 'translate_infowindow_message');
function translate_infowindow_message($message) {
    $translated_message = __('Your translation logic here', 'textdomain');
    return $translated_message;
}

Example 3

Description of the third use-case: Adding shortcode support to infowindow messages to include dynamic content.

add_filter('wpgmp_infowindow_message', 'do_shortcode_infowindow_message');
function do_shortcode_infowindow_message($message) {
    return do_shortcode($message);
}

Tip: Always validate and sanitize the data being passed through hooks to prevent security vulnerabilities such as XSS attacks.

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.