Created
July 22, 2012 18:10
-
-
Save jcanfield/3160549 to your computer and use it in GitHub Desktop.
Google Maps Shortcode for Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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.'&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