Skip to content

Instantly share code, notes, and snippets.

@jcanfield
Created July 22, 2012 18:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcanfield/3160549 to your computer and use it in GitHub Desktop.
Save jcanfield/3160549 to your computer and use it in GitHub Desktop.
Google Maps Shortcode for Wordpress
<?php
// Name: Google Maps Shortcode
// Description: Shortcode to display Google Maps in Page or Post
//Google Maps Shortcode
function fn_googleMaps($atts, $content = null) {
extract(shortcode_atts(array(
"width" => '640',
"height" => '480',
"src" => ''
), $atts));
return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'&amp;output=embed"></iframe>';
}
add_shortcode("googlemap", "fn_googleMaps");
// Usage
// [googlemap width="200" height="200" src="http://maps.google.com/somelocationnumbershere/"]
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment