Return to Snippet

Revision: 23695
at March 5, 2010 12:12 by cyberhobo


Updated Code
// Try only if Geo Mashup plugin is active
if ( class_exists( 'GeoMashup' ) ) {
	$current_location = GeoMashupDB::get_post_location( get_the_ID() );
	if ( $current_location ) {
		// The current post has a location, so include the map
		$map_arguments = array (
			'map_content' => 'global',
			'center_lat' => $current_location->lat,
			'center_lng' => $current_location->lng,
			'marker_select_info_window' => 'false',
			'marker_select_highlight' => 'true',
			'marker_select_center' => 'true',
			'auto_info_open' => 'true',
			'open_object_id' => $current_location->object_id
		);
		echo GeoMashup::map( $map_arguments );
	}
}

Revision: 23694
at February 11, 2010 12:00 by cyberhobo


Updated Code
// Try only if Geo Mashup plugin is active
if ( class_exists( 'GeoMashup' ) ) {
	$post_coordinates = GeoMashup::post_coordinates();
	if ( $post_coordinates ) {
		// The current post has a location, so include the map
		$map_arguments = array (
			'map_content' => 'global',
			'center_lat' => $post_coordinates['lat'],
			'center_lng' => $post_coordinates['lng']
		);
		echo GeoMashup::map( $map_arguments );
	}
}

Revision: 23693
at February 11, 2010 11:53 by cyberhobo


Initial Code
// Try only if Geo Mashup plugin is not active
if ( class_exists( 'GeoMashup' ) ) {
	$post_coordinates = GeoMashup::post_coordinates();
	if ( $post_coordinates ) {
		// The current post has a location, so include the map
		$map_arguments = array (
			'map_content' => 'global',
			'center_lat' => $post_coordinates['lat'],
			'center_lng' => $post_coordinates['lng']
		);
		echo GeoMashup::map( $map_arguments );
	}
}

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

Initial Description
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.

Initial Title
Global Geo Mashup map centered on current post

Initial Tags
template, wordpress

Initial Language
PHP