RRWD Single Google Map WordPress plugin

Google Map

Note: this plugin is no longer maintained.

What’s this plugin for?

To show a Google Map with your post or page, simply by adding the address into the custom field ‘address’.

For example: Adding “Diepenveenstraat 33, 5043 JL Tilburg, Nederland” to the custom field ‘address’ results in the map at the bottom of the post about the sewing school Avainti.

How to install

  1. Current stable release is version 0.2
  2. Upload `rrwd-single-google-map.php` to the `/wp-content/plugins/` directory
  3. Activate the plugin through the ‘Plugins’ menu in WordPress
  4. Add ‘<?php rrwd_include_single_google_map(“style”) ?>‘ to the template files single.php and page.php within the loop. e.g. <?php rrwd_include_single_google_map(“width: 500px;  height: 400px;” ) ?>
    Or leave empty if you want define the style of #map_canvas in the stylesheet,
    <?php rrwd_include_google_map(); ?>
    in style.php e.g: #map_canvas { width: 500px;  height: 400px; padding: 20px 0 20px 0; margin: 0; }
  5. Please report bugs or mail me suggestions at rian@rrwd.nl

How to use

First of all, install the plugin and add the rrwd_include_google_map function call to the single.php and/or post.php templates.  Dont forget to add style code to the function call or add the CSS to style.css.

Then in Admin add or edit the post or page in which you want the map to appear and add in custom fields the name address and fill out the address for the Google Map.

This is actually quite flexible.
You can be very detailed like: Saal van Zwanenbergweg 11, 5026 RM, Tilburg, Nederland
Or less detailed like: 5026 RM, Nederland
Or more global like: New York, NY
Or even: New Zeeland
The more details you give, the more accurate the maker will be placed.

How to get this plugin

Download it from WordPress.org

If you like the plugin, please vote for it, or buy me a beer.


Question: I don’t see the map

Answer: Check if you have the style filled out in the function call, like:
<?php rrwd_include_single_google_map(“width: 500px;  height: 400px; “) ?>
Or check if you have defined the style into your stylesheet like:

#map_canvas {
width: 500px;
height: 400px;
margin:  10px 0 10px 0;

No style, no map.

Question: Can I place the map wherever I want??

Answer: You have put the map inside the loop of single.php and/or page.php, and you have to change “style” in some kind of style definition, like:
<?php rrwd_include_single_google_map(“width: 400px; height: 400px;”) ?>
for more explanation about the loop see: http://codex.wordpress.org/The_Loop and http://codex.wordpress.org/The_Loop_in_Action

Question: I get a Fatal error: Cannot instantiate non-existent class: simplexmlelement

Answer: If you get this Fatal error: Cannot instantiate non-existent class: simplexmlelement in /…/wp-content/plugins/rrwd-single-google-map/rrwd-single-google-map.php on line 241

The server you are running must be able to execute SimpleXMLElement, so it can read the XML-file from Google to get the latitude and longitude. Your PHP installation needs the module PHP:MXL
Ask your provider to install it, if that is possible.


Adding the custom field address
RRWD Single Google Map in a post

Current Version

Version 0.1, first release, September 8, 2010


If you have questions or suggestions please contact me via e-mail or add a comment in the comment section below.

For Dutch readers: the development of this plugin is described in the post  Automatisch Google Maps kaartje bij een WordPress post


Author: Rian Rietveld

WordPress Engineer focussing on accessibility

7 thoughts on “RRWD Single Google Map WordPress plugin”

  1. I get this error:

    Fatal error: Call to undefined function rrwd_include_google_map() in /home/bizadmin/public_html/wp-content/themes/Bizzcaster/single.php on line 54

    I have the plugin installed and activated. Somehow it thinks the function doesn’t exist.

    Any help is appreciated.


  2. it works! On all browsers!

    A few small suggestions:
    I would be great if we can custom fill the balloon with some text and link
    it would also be very helpful if we can set the zoomlevel of the map

    for the zoom, the link and text it would be great if we can add another custom-field rrwd-balloon and rrwd-zoom

    and it would be helpful as well if the custom field : address could be changed into rrwd-address

    address is just to generic, lots of people might already have a custom field floating around with that name



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s