Google maps shortcode

Adding the first block of code to your functions.php will allow you to use shortcode to add google maps to your wordpress blog.

 

 

 

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.'"></iframe>';
}
add_shortcode("googlemap", "fn_googleMaps");

[googlemap width="200" height="200" src="[url]"]

Leave a comment