Global Geo Mashup map centered on current post


/ Published in: PHP
Save to your folder(s)

Use this code in a WordPress template with the Geo Mashup plugin (see URL) to include a global map within a post or page, centered on that post or page's location, with marker highlighted.


Copy this code and paste it in your HTML
  1. // Try only if Geo Mashup plugin is active
  2. if ( class_exists( 'GeoMashup' ) ) {
  3. $current_location = GeoMashupDB::get_post_location( get_the_ID() );
  4. if ( $current_location ) {
  5. // The current post has a location, so include the map
  6. $map_arguments = array (
  7. 'map_content' => 'global',
  8. 'center_lat' => $current_location->lat,
  9. 'center_lng' => $current_location->lng,
  10. 'marker_select_info_window' => 'false',
  11. 'marker_select_highlight' => 'true',
  12. 'marker_select_center' => 'true',
  13. 'auto_info_open' => 'true',
  14. 'open_object_id' => $current_location->object_id
  15. );
  16. echo GeoMashup::map( $map_arguments );
  17. }
  18. }

URL: http://code.google.com/p/wordpress-geo-mashup

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.