Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify Info Window Contents for Posts Using Hook
add_filter('wpgmp_infowindow_post_message', 'wpgmp_infowindow_post_message',1,2 );
function wpgmp_infowindow_post_message($message,$map) {
global $post;
//This will apply for map id 1.
if( $post->ID == 1) {
$message = "<h1>{marker_title}</h1>";
}
if( $post->ID == 107) {
$message = "<h1>{marker_title}</h1><p>{marker_address}</p>";
}
return $message;
}
@lovecodder

This comment has been minimized.

Copy link

commented Apr 16, 2019

where I put that code..?

@purivus-dev

This comment has been minimized.

Copy link

commented Aug 5, 2019

Please don't torture people with that rubbish!
When calling $post->ID, you get the id of the current page or post, where map is embedded.
Instead why not using the $map-object with $map->map_id ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.