Google Map Shortcode Version 1.1
The new version of Google Map Shortcode is ready, some bugs were fixed and new features included.
The first release was based on “address”, then to include a point on the maps new instance of google geocoder was need, but google limits the number of this kind of request, read more here.
In this version new custom field “google-map-sc-latlng” was included to save the (Latitude,Longitude) for each address entered:

Now, you can include points on your maps using one of this custom fields considering this:
- If you use “google-map-sc-address”, the first time that you display a point, the “google-map-sc-latlng” value will be generated automatically.
- In order to use “google-map-sc-latlng” you need to include the latitude and longitude separated by comma.
- If you update “google-map-sc-address” you must delete the “google-map-sc-latlng” cause this point will be located based on the previews address.
- You can use “google-map-sc-latlng” only.
- If you are planning to display large number of point is better to use “google-map-sc-latlng” or generate them one by one to avoid large number of address requests at the same time. You can generate latitude and longitude using for instance: http://www.batchgeocode.com/lookup/
- You can attache more than one point per post/page but based on address or (latitude,longitude) see the example bellow.
- If you are displaying all the points under specific category, just the first costum field of each post will be used.
The shortcode options can be found in the first release.
Examples
This example shows the points attached to the posts under the category 42 cat=”42″ and display the links to the points at the bottom of the map, external_links=”true”.
and the custom fields looks like this:
Using the post “id” id = “335″.
Using specific address option in the sortcode (not the custom field) address=”3501 S.W. 130th Ave., Davie 33330″,width=”250″, height=”250″ and zoom=”8″.
Notes
The Info Window is showed when you are displaying post on your maps for example the posts under a category or when you use the post ID, just in these cases make sense to display the the title, thumbnail and excerpt of your posts.
You can change the html and the css of the Info Windows to cutomize it.
The shortcode name is google-map-sc
Download
Add your suggestions, support the plugin.




maps are not being displayed onto the page
where the map should be there is the following in the html
div style=”display: none” UA:D [1.8.1_1037] closing div
@Alex Stanhope
Can you please include the page where the map is deploying.
Thanks
@Alex Stanhope
Alain,
I’ve sorted out hiding the “balloon”/clicking through to posts point I raised in my previous message – just needed some judicious use of location.href and commenting out the call to openInfoWindowHtml; pretty simple to do in all honesty!
However, I’m still a bit flummoxed as to why one of the several maps on my page isn’t centering properly – any thoughts?
I’ll look forward to your response!
Alex
Hi Alain,
Firstly, thanks for taking the time to code up this great plug-in, which I have just installed on a WP 2.9.1 site I’m currently building, and I can confirm that everything is working fine as regards compatibility between Google Map Shortcode 1.1 and WP 2.9.1
I did have a couple of quick questions though – is it possible to disable the InfoWindowHTML “balloon” that appears when markers are clicked, and just have it so that the markers click through to the posts that they are associated with?
Also, I’ve got a couple of maps set up on the site, but on one of them, the Map window doesn’t seem to centre on the “cluster” of markers that are shown within it – in fact they, seem to go off the edge of the map. The development version of the site is password-protected, but I’ll gladly provide the relevant details if you wanted to take a look at all?
Thanks again for all your great work!
@Tim Hall
Yeh, just use enter the lat long into the custom field google-map-sc-latlng
This is a great plugin, the best I’ve used for Google Map integration, not least because you can use it in your templates. One issue I’m having though, is there anyway if using longitute / latitude instead of “address” when using it in templates?
Ok I managed to fix it so that it shows the latest blog post on the center point of the map
open google-map-sc.js and replace line 28
this.placing(GMpointsArray[i]);
with
this.placing(GMpointsArray[0]);
I am still trying to sort out the external links into categories
Hey, great plugin… I thought of 2 things that would be really good… 1) if the map centers to the latest blog post 2) have it so the external links are categorized….
Hello there,
I tried to include a map in one of my pages using your plugin.
I’ve added [google-map-sc address="some address"] in my page but nothing shows up.
I’ve applied changes suggested by Zafrir (wpurl and wp_remote_fopen) but this haven’t fix the issue.
By the way, I’m using Wordpress 2.9.1.
Any idea?
@Eudald
Do not use commas and “option = ” in your shortcode.
Thanks
Hi mates!
Nice pluguin! Just a question, is there any limition of size for the map? I am trying to enlarge the map but, it is not working at all. I am using the parameters bellow: [google-map-sc option = width="600,height="300", zoom="3"] but there is no way to get that width. Pls help!

Oh, and happy new year!
@Alain
Oh, maybe it is because I am on v2.9.1? Hm … this is not a major issue, so don’t panic.
@Jonas
In the new version I’ll fix it and test for the new 2.9 versions.
Thanks!!!
The option “allow_url_fopen” is ticked in my php.ini. Changing “the plugin javascript includes is using bloginfo(’url’) it should change to ‘mpurl’” didn’t help at all. Instead only the canvas without the map is being displayed. Regarding “google-map-shortcode.php line 649″, this didn’t help either. My article contains “Map 1
[google-map-sc zoom="15" address="Am Nordwerk 14, 85659 Forstern, Deutschland"]Map 2
[google-map-sc]”
The first map is available, for the second one there is not even a canvas, although I defined the field “google-map-sc-address”.
Now it works for me after doing what Zafrir Ron suggest a couple of comments below to change on: google-map-shortcode.php line 649
Works with both custom fields and if I add the address to shortcode.
Alain: This might be something to change to in version 1.2?
@Jonas: have you managed to solve the issue with the map not showing up? I have the same problem.
Over here it works when ignoring the custom field and just adding the full address as parameter to [google-map-sc]. But this didn’t work for you either, did it?
hi,
just ran into a problem when I set my blog to be in the root folder of my website but kept the wordpress installation in a folder other than the root folder.
“google-map-shortcode.php” gets the URL of the site by calling “get_bloginfo(’url’)” at lines 25 and 26 but it should call “get_bloginfo(’wpurl’)” to get the actual URL of the installation. making this change fixed the problem.
fyi.
@Zafrir Ron
in order to fix this on hosting without access to php.ini use wp_remote_fopen function;
change:
google-map-shortcode.php line 649
comment out:
//if (!($fp = @ fopen($url, ‘rb’)))
//{
// return array ();
//}
//while (!feof($fp))
//{
// $contents .= fread($fp, 8192);
//}
//fclose($fp);
replace with
$contents = wp_remote_fopen($url);
Just one more small bug found:
the plugin javascript includes is using bloginfo(’url’) it should change to ‘mpurl’
the bug is cousing map not displayed on blogs that installation folder is dofferent from blog home url (looking on wrong js folder location);
change in google-map-shortcode.php lines 25,26
After spending few hours trying to find why Maps are not displyed reading some comments here about the problem.
debuggin the plugin code..
I suggest to add a cleare requrement direction to make sure that the server PHP ini option allow_url_fopen is set to true.
If not the script can not open google map XML responce and will not display anything with no warning nothing will be displayed.
hope saved some headackes for you guys…
Zafi
After further digging this appears to be an incompatibility with EC3 Event Calendar plugin: http://wpcal.firetree.net/ I am not sure which is wrong but bout EC3 and GMSC are “emulating” the_excerpt().
I am running into an issue with the plugin which I can’t seem to resolve.
On my archive pages which make use of the “the_excerpt()” tag, I am getting Javascript output as text in my post content. Any idea why? I looked through your plugin code and it appears that you have a filter to process shortcodes in the the_excerpt() but that function is never getting called.
It appears that the shortcode is partially being processed as the Javascript to produce the map canvas is generated but the DIV and SCRIPT tags that surround it are not in the output.
Yes, but if you check the actual post in the admin interface, you’ll see that I’ve written:
and on the other active post:
@Jonas
I dont see the shortcode there. Just:
you need something like:
Please try now, go to the root of the website and you will see two posts, both with shortcodes for the plugin. If you want to admin, login to /wp-admin with admin and password testtest.
Thanks a lot for helping out since I really want to get your plugin to work.
@Jonas
Yes, your comment was in hold maybe for the links.
When Itest them I get somr php errors.
Alain, it seems like you missed my comment on November 30th (maybe because it’s awaiting moderation). Any idea what could be wrong?
@Alain
Thanks for redirecting me to the documentation. I figured out a couple of new items. I did get the shortcode to work in a text widget, I had a bad value in my fields previously.
Some additional questions:
Does this plugin allow for exporting a Geocoded RSS feed?
How can I make the infowindow NOT open when you click on a marker? Instead just link directly to the post? (Thinking in maps with multiple markers).
Lastly, to rephrase a previous question… if I have the shortcode working in a text widget, is there any way to make it so the markers shown on that map are ONLY from the posts on THAT page which have the google-map-sc info in the custom fields?
Thanks again, I am also testing out your Accordian Image plugin which is beautiful.
Mitch
@Phil
In this case you just need to include the custom fields and the shortcode “google-map-sc” on your post.
Does this work with the Google Earth API (Satellite_3D maptype)
Hi Alain
What kind of shortcode do I need if I would like to have multiple points on the same map as in your example number 2? I added the points using the lating custom fields as you proposed but unfortunately there is no map display on my page at all! Thanks for helping me
Greets
Phil
@Alain
http://dev1.back.nu/index.php/archives/23 and http://dev1.back.nu/index.php/archives/15 both should have a map. If you e-mail me at jb (at) back.nu I would be able to provide you with the Wordpress admin login.
@Jonas
Can you please include a URL. I tested the plugin until v 2.8.4.
@Jonas
Just a comment, I don’t get any error and when I look on the HTML output code where the Google Maps code should be it’s empty. I don’t get anything in the error_log file either but I see in the logfile it loads the google-map-sc-style.css and google-map-sc.js. Tested both IE and Firefox.
I can’t get it to work – it simply doesn’t display any maps. I tried adding the address both in the shortcode, for example:
[google-map-sc address="33 W 55th St, New York, NY 10019, USA"]
and as a custom field:
google-map-sc-address set to 33 W 55th St, New York, NY 10019, USA and then using only the following shortcode:
[google-map-sc]
The map never shows up. I’ve tried two different domains (each with their own API code) and the domain does not contain any strange international letters.
Any ideas where to look? This plugin fits my needs perfectly. Using Wordpress 2.8.6.
@mitchell
The plugin doesn’t includes widget feature.
More info on the first release http://web-argument.com/google-map-shortcode/.
Thanks
Hi,
I have a feature question… Can I use the short code in a widget or is there a widget feature (short of modifying php), where the map will reference the post or posts (or category) which is currently displayed on that page?
Thank you, you do very nice work.
Mitch
The Google Maps API key that was issued to me never worked … so things may have hung there … But mootools JS module to animate the images broke for the sliding-doors part of my RedLine theme when this plugin was activated. When deactivated, the js script returned to working.
Not sure what’s going on, haven’t had time to troubleshoot to see what’s hanging up … But just thought I would comment in case others were experiencing the same and didn’t know what was causing the problem.
@Rick
The comment box ate my code.
Anyway, I just edit bloginfo(’url’) to bloginfo(’wpurl’) so the header would include the correct path to the javascript and styles
Hi Alain,
The plugin does not work when installed on a Wordpress installation where the Blog URL and Wordpress URL are different.
I had to edit your script in the lines:
$wpchkt_header .= “\n”;
@Max Hugen
Did you get the API key for the domain where you are using the plugin?
I obtained an API key and pasted into the API field for the Plugin, but when I [Save], it keeps returning ‘Error: Bad Google API Key.’
I can’t see anything I’m doing wrong…. is this something I should try to take up with Google Maps?
@Fabio
“42″ is the id of the category of the post I want to deploy on the map.
And external_links=”true” is a parameter that allows to disply the links outside of the map.
For more info about wordpress shortcode just look into this link.
http://codex.wordpress.org/Shortcode_API
Thanks,
Hello, I’m very new to WP and working with plugins. I am setting up a listing of free parking lots in my area. I currently have it working much like you have in the second example using custom values, but I would like it to look like you first example.
I’ve gone through your documentation and I am confused by the usage. I don’t understand where you are getting the cat 42 value from or how you are linking the text location specifically to the map above it. Can you display the code for that example?
Thank you
Nice wp-plugin!
Your maps on the this page are shown in my Ubuntu Firefox, why is my map grey in Win IE and Ubuntu Firefox? Same map works in Mac Safari and Win Chrome.
Thanks
Thanks for your great plugin! I spent a few hours researching the options out there for WP and this was definitely the best one for me.
Keep up the good work, I look forward to new updates and features
Is there a way to display a bubble with the address and “directions to” link?
I was wondering if there are any plans to release an updated version of your plugin that includes an option to get driving directions from map points. I have been looking for one that combines the capabilities of having multiple map points and driving directions to those map points. The only other plugin that is even comparable to yours is wp Google Maps, but does not have the option of adding multiple map points to a map.
Sorry to leave so many messages.
Alain, do you think you will provide a new version of Google Map Shortcode with the version 3 of the Google Maps API ?
I tried many ways but I couldn’t make it. May be I was not far from making it, but my knowledge is definitely to short.
Thank you
I found some answer on Google.
It seems that Google Maps API has some problems with international domain names, on some browsers.
It seems that there are problems when the URL shows the Japanese characters. On the Opera browser, the URL shows the Japanese characters but not on Firefox.
There is a new version of Google Maps API, the version 3. On that version, there is no need anymore for an API key.
I will try to see if I can change the code of your plugin to make it work with the version 3, even if I’m not sure my knowledge in programming is good enough to succeed in making it work.
Hope I can finally find a good solution.
Raphael
I think I found the reason of my problem, but I don’t know how to find a solution. And I don’t know if the problem comes from the plugin or from Google.
The domain I want to use the plugin on is an international domain name, meaning that the domain name is directly written in Japanese, Chinese, Hindi…
On some browsers, like Opera or Safari, may be the last version of IE, you will see the Japanese characters in the domain name.
On Firefox, you will see a URL beginning by http://www.xn--. The code for all international domain names begin by xn--.
I tried your plugin on usual domain names that contain only letters or numbers and it worked.
I tried it on some other international domain names I use and it didn’t work.
I guess it should work because when I apply for an API key on Google, with international domain names, I do receive a key. And in the line: “This key is good for all URLs consisting of this registered domain (and directory if applicable):”, the URL written begins by xn--.
I’ll ask on Google forums if they know something about international domain names.
I will let you know if I get an answer.
Hi
Do you have any idea what kind of problem I have with my API key ?
When using the Opera browser, any time I refresh the page, I get this kind of Javascript error message:
This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/.
But I always get the same key, since it is always for the same website I am asking it for.
When using Firefox, there is no error message.
But anyway, when I update the key in the Google Map Shortcode Settings, I get this message: Error: Bad Google API Key.
I would like to know if some other persons face the same problem, or is it only me ?
Thank you
Yes I did register the key for the domain where I am using the plugin.
@Raphael
Did you register this key for the domain where you are using the plugin?
The google-map-sc-latlng is generated after deploying the map. In that moment is when you request google map not saving the post.
Thanks.
Oh and there’s one thing I don’t understand either.
You said that “google-map-sc-latlng” was automatically added. But actually when I use the shortcode with the address and save the post, if I look at the custom fields, I don’t see the keys google-map-sc-address and google-map-sc-latlng.
Is it due to my API key problem ?
Thank you for your support.
P.S: I’m using WP 2.8.3. Do I need 2.8.4 ?
Hi Alain
I still have problems with my API key. The plugin is still telling me my key is wrong.
How can I fix that ?
Thank you
Raphael
????
@Lars
Did you get javascript errors?
Can you please include a url?
Hello
I would like to use your plugin to show a google map on a page. I inserted the shortcode and a custom-field. But nothing happened. The page is empty.
I use the latest wordpress.
Where is my mistake?
regards
@Chuck Brown
For sure, this is a very basic google map integration, the others features can be included: street view, Get directions: To here – From here. Working on the info window section. I’ll work on that in a future.
Thanks,
I am curious – is there a way to add-in the ability to search? For instance I am making a directory of churches in my local area – I am wanting to have folks be able to put in their address, as the starting/centered point but then have the other points from posts be scattered around it.
Any easy way to do this with the codes I am missing, or would it take a tad more code to make it do the magic?
Great plugin! As soon as my paycheck comes on the 15th, donate button will indeed be clicked! Save me MANY hours of coding a list by hand, plus keeping the info in posts has also made it easy to manage the listings in greater detail.
@Mitchell
You can go to the google map api to see how they make tabs and change the google-map-sc.js.
Thanks.
Finally. I’ve looked at 15 map plugins, and this is the best one for what I want. Thank you. I had tried it before, but the 10 point limit made me keep looking. This update fixes that. Thank you. I would have one request… Please tell me how I would make the Info Window have a second “tab” that I could put some other html in. Thanks in advance.