This hook is used in the WP Maps Pro plugin to allow developers to customize or append additional HTML content immediately after the listing container of a map. It is triggered after the map listings have been rendered, providing an opportunity to modify or enhance the output.
Usage
Developers can implement this hook in their WordPress themes or plugins by adding a callback function to it. This hook is particularly useful for adding custom information, advertisements, or other content after the map listings are displayed. It accepts two parameters: an empty string (reserved for potential future use) and the map object.
Example 1
This example demonstrates how to append a custom message after the map listing.
add_action('wpgmp_after_listing', 'append_custom_message', 10, 2); function append_custom_message($html, $map) { echo '<div class="custom-message">Thank you for viewing our listings!</div>'; }
Example 2
In this example, additional navigation links are added after the map listing to enhance user interaction.
add_action('wpgmp_after_listing', 'add_navigation_links', 10, 2); function add_navigation_links($html, $map) { echo '<div class="navigation-links">'; echo '<a href="#previous">Previous</a> | <a href="#next">Next</a>'; echo '</div>'; }
Example 3
This example shows how to integrate a social media sharing widget after the listings for increased engagement.
add_action('wpgmp_after_listing', 'add_social_media_widget', 10, 2); function add_social_media_widget($html, $map) { echo '<div class="social-media-widget">'; echo '<a href="https://facebook.com/share">Share on Facebook</a>'; echo '<a href="https://twitter.com/share">Share on Twitter</a>'; echo '</div>'; }
Tip: Always sanitize and validate any dynamic data you are outputting to ensure security and maintain the integrity of the website.