Posted By

cyberhobo on 02/11/10


Tagged

template wordpress map wordpress-geo-mashup


Versions (?)

Global Geo Mashup map centered on current post


 / Published in: PHP
 

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

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.

  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. }

Report this snippet  

You need to login to post a comment.