Skip to content

Instantly share code, notes, and snippets.

@sanjaybhowmick
Created April 26, 2016 06:40
Show Gist options
  • Save sanjaybhowmick/cfd67bc1f7cfea7c3c6b30e9a9690971 to your computer and use it in GitHub Desktop.
Save sanjaybhowmick/cfd67bc1f7cfea7c3c6b30e9a9690971 to your computer and use it in GitHub Desktop.
Google Map Embed in WordPress Post / Page
<?php
// Google Map embed short code
// Usage: [googlemap src="you_url"]
function GoogleMapEmbed($atts, $content = null) {
extract(shortcode_atts(array(
"width" => '100%',
"height" => '480',
"src" => ''
), $atts));
return '<iframe width="'.$width.'" height="'.$height.'" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'.$src.'" ></iframe>';
}
add_shortcode("googlemap", "GoogleMapEmbed");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment