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”.

In this example the map displays some points on South Florida:

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

google-map-shortcode

Add your suggestions, support the plugin.


91 thoughts on “Google Map Shortcode Version 1.1”

  1. This plugin allows you to include instances of Google Map in your blogs using the wordpress shortcode API. You can insert maps everywhere: in your theme files, posts and pages. The use of a custom field allows you to insert posts on the maps as points.

  2. For those with WordPress in a different location than their bloghome:
    Replace the call in line 15 (google-map-shortcode.php) from “.get_bloginfo(‘url’).” to “.get_bloginfo(‘wpurl’).” to be able to load the .js file.
    Else your map won’t load.

    Greets

  3. Just a general layperson web surfer’s perspective. I’m not a developer, but I am constantly bothered by these google API messages whenever I browse a page with related stuff. I can use google maps oddly though. Loading this page gives me this error pop-up:

    This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/.”

  4. Hey Alain,

    Is there any reason at all why the custom field option should not work? Maybe the post should be in a speacial loop, any type of query? Global settings perhaps? I read a lot posts from people experiencing the same problem with the first version. Maybe you can post some additional requirements?

  5. Hey Bob,

    You can get a gap bij adding a selector with margin or padding to your stylesheet:

    For example:
    #canvas_jyN0 { margin-bottom:20px; }

    Still nobody kwnows if there could be any reason why the custom fields function doesn’t work in my site? Could permalinkstructure have any influence?

    This is my shortcode: `[google-map-sc id="484" width="380" height="290" zoom="12" number="2"]`

    And this is the page http://2010.jurisverbeelding.nl/info/contact
    It works on 2.9.1

    Thanks!

  6. Thanks for this plugin! Unfortunately I can’t get it to work using custom field. Whenever I enter options in the shortcode it works fine but when I enter the post-id to get custom fields nothing happens.

    I tried all the hacks and modifications here which even led to a complete wordpress crash.

    This is my shortcode: `[google-map-sc id="484" width="380" height="290" zoom="12" number="2"]`

    And this is the page http://2010.jurisverbeelding.nl/info/contact

    Anybody?

  7. The maps don’t leave a space after them on my theme – following paragraphs seems to start immediately and it looks ugly. How can I add a gap that follows a map?

  8. I just have a quick fix for this plugin that enables you to only include the Google Map scripts if the page contains the shortcode [google-map-sc ...]. This means the other pages of your site can still render quickly and without the delay due to sourcing Google code.

    See below which replaces the gmshc_head function in google-map-shortcode.php. The only difference being the global $post and ‘if’ wrapper. Works well on one of my sites…:

    function gmshc_head() {
    global $post;
    if (strpos($post->post_content, “[google-map-sc”) !== false) {

    $options = get_option(‘gmshc_op’);

    $gmshc_key = $options[‘gmshc_key’];

    $wpchkt_header = “\n\n”;

    $wpchkt_header .= “\n”;

    $wpchkt_header .= “\n”;

    $wpchkt_header .= “\n”;

    $wpchkt_header .= “\n\n”;

    print($wpchkt_header);
    }

    }

  9. Has anybody else experienced problems with displaying a map using categorys? When I first installed the plugin I was able to display a map of every post within a specific category. Here is an example of the code I used: [google-map-sc width="400" height="400" zoom="11" cat="25"] Everything worked fine. Now, nothing, It is as if it isn’t even generating a map.

    I don’t have any problems generating maps in a post that has the google-map-sc-latlng custom field.

    The posts in the the categories I am trying to display all have the google-map-sc-latlng custom fields in them.

    I am running wp 2.9.2

    Any suggesting is appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *