To create the shortcode, paste the code below into your functions.php file:
function rockable_googlemap($atts, $content = null) { extract(shortcode_atts(array( "width" => '940', "height" => '300', "src" => '' ), $atts)); return '<div> <iframe src="'.$src.'&output=embed" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="'.$width.'" height="'.$height.'"></iframe> </div> '; } add_shortcode("googlemap", "rockable_googlemap");
Once you saved your function.php file, you can start integrating Google Maps into your posts and pages. To do so, get the url of the map you'd like to display, and use the shortcode as shown below:
[googlemap src="google_map_url"]
or with custom width and height parameters:
[googlemap width="600" height="250" src="google_map_url"]
Thanks to Rockable Themes for the tip!