Skip to main content

Posts

Showing posts from April, 2016

Embed responsive google map into WordPress post or page without plugin

From personal blog, travel blog to company web page, we need to embed Google Map to show proper location. There are few WordPress plugins available to serve the same feature. But I always intend to not using WordPress plugins if it can be served by writing code. We can create a simple WordPress shortcode to enable Google Map embed feature inside post or page. How to create Google Map embed shortcode? 1.Open functions.php file in your theme folder. 2.Put the following code and save the file. <?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" marginwid