Skip to content

Instantly share code, notes, and snippets.

@wpflippercode
Created September 8, 2017 06:55
Show Gist options
  • Save wpflippercode/1293f805f532494e0b8d5dc05caef749 to your computer and use it in GitHub Desktop.
Save wpflippercode/1293f805f532494e0b8d5dc05caef749 to your computer and use it in GitHub Desktop.
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;
}
@purivus-dev
Copy link

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