Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Created October 27, 2011 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninnypants/1318645 to your computer and use it in GitHub Desktop.
Save ninnypants/1318645 to your computer and use it in GitHub Desktop.
Map Shortcode
<?php
add_shortcode('map', 'location_map');
function location_map($atts){
$urlp = parse_url($atts['address']);
$q = parse_str($urlp['query']);
if(!empty($q['q'])){
return '<a href="'.$atts['address'].'"><img src="http://maps.google.com/maps/api/staticmap?center='.$q['q'].'&zoom=14&size='.$atts['w'].'x'.$atts['h'].'&maptype=roadmap&markers='.$q['q'].'&sensor=false" class="map" /></a>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment