There are several WordPress plugins for showing Google maps on blog pages exist, but unfortunately, they are all kind of do "too much" :) Like displaying your posts on a Google map, or something like that. What I needed is just a simple plugin which would allow me to embed a Google map into my WordPress blog pages, anywhere I want, preferrably with a single line of simple code. There was nothing like that so I have wrote my own plugin. It's easy to use and install, and works fine so.. here we go :)
Inline Google Maps Plugin v1.1 for WordPress
(download link is at the bottom of the page!)
Displays Google Maps anywhere in your blog page post by including a simple html-like code into a post.
New in version 1.1
- much better support for embedded HTML in the 'desc' tag. Basically, as long as you use single quotes ( ' ) to enclose parameters, and use NO single quotes inside the 'desc' tag (you can use double-quotes just fine) – you can insert almost anything you want into the map marker balloon. Have fun :) Ah.. and here's a picture of the code used to display content of the map balloon you will find below on this page.
- Tested to work with WordPress 2.0.x
- Uses Google Maps API version 2.0
- Supports English and Japanese map captions (site-wide setting)
- Admin panel to set Google Maps API key and site-wide Inline Google Maps language
- Allows to set map width and height, as well as latitude, longitude and description of the marker on a map
- Supports setting of single marker for single map
- Supports unlimited number of maps in any single post (as long as "name" attributes are different for different maps)
- To install, just put the gmaps.php file inside your wp-content/plugins folder and activate the plugin in admin panel
- After installing and activation, go to WordPress admin -> Options -> Inline Google Maps and enter your Google Maps API key, as well as set the default language for maps
- you need to do is just put a code like the one below anywhere inside your postHere's in the tag in plain text (replace * at the beginning with [ and the last * with ] for this to work!!):*gmap name='mymap' lat='35.163757' lng='136.910709' zoom='17' desc='This is my Inline Google Map!'*And it will rendered into something like you see below:
[gmap name='mymap' lat='33.640531' lng='-84.425565' zoom='14' desc='This is my Inline Google Map! Now with support for better HTML']
- That's it!
- "width" : width of the map (defaults to 500px if not set)
- "height" : height of the map (defaults to 300px if not set)
- "lat" : latitude of place/marker
- "lng" : longitude of place/marker
- "zoom" : initial zoom (0 – least, around 20 – most)
- "desc" : description of marker (you can use HTML code, and it should work fine unless you use the ' symbols inside)
Important!! All parameters values MUST be encosed in ' (single quote mark) symbols, and not the " (double quote mark) ones! See the example above.
- Your site should be UTF-8 encoded (although the plugin SHOULD work for other encodings). There is a problem with IE for Windows on Japanese Windows systems when page encoding is not set to UTF-8, but to ShiftJIS (errors, map is not loaded). Switch your page encoding to UTF-8 to fix the problem.
- Google Maps are known as crashing Internet Explorer on Windows if not put to specific place on the page to be called after the whole page is loaded. The Inline Google Maps plugin uses special technique to ensure the initialization of the map called at the right time without need to juggle with the code.
- I'll omit all the blah-blah regarding it is my first plugin for WordPress and the version is 1.0, and that I don't really have much time to work on it (created it for one of work projects). So I'm just asking you if you have any comments or suggestions – fire them off in the comments :)