Created
September 8, 2017 06:55
-
-
Save wpflippercode/1293f805f532494e0b8d5dc05caef749 to your computer and use it in GitHub Desktop.
Modify Info Window Contents for Posts Using Hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
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
where I put that code..?