Display Geo location Map on Page Load Geolocation WordPress Plugin

I recently installed the Geolocation WordPress Plugin on one of my private blogs to allow me to Geotag my posts with a location from wherever I might have been at the time of posting. The main feature that really stood out for me was the ability to Geotag posts using the WordPress iOS app, when writing a post from my iPhone I could Geo tag that post accurately using my phones built in GPS capabilities.

However I wasn’t entirely happy with the way that the maps were being displayed, in the current version 0.1.1 you have to hover over the the text description of the location, like below and the map will then popup on your mousehover.

Wordpress Geolocation Map Before

Wordpress Geolocation Map Before

I’ve changed the code of the plugin to show the map on page load, which for my use works better than the mouse over. I code is pretty hacky but it works, perhaps I could extend the plugin at a later date to allow an option to be selected in the admin on which functionality you prefer, depends on the feedback I receive from this I suppose.

Wordpress Geolocation Map After

Wordpress Geolocation Map After

To enable this on your own WordPress installation simply download the files below and drag them into the geolocation plugin folder, obviously remove the .txt extensions from the file names and replace the corresponding files within that directory. If this plugin is updated (Currently these modifications are for version 0.1.1) the files attached here wont be compatible as the code would have changed.

Download

style.css geolocation.php

Update (30/04/2011)

I’ve added a few options to this plugin and also moved the code over to my own github repo which you can view here https://github.com/Snaver/Geolocation, a few of the changes are:

  • added the option for how you wish the map to be dislayed i.e link w/hover (default) or full map on page load. Just like this http://www.snaver.net/2011/02/21/display-geo-location-map-on-page-load-geolocation-wordpress-plugin/
  • Reworked javascript to allow for multiple maps per page. Modified output of HTML in the post also
  • Added the ability to display all posts on a Google Map, on any page/post simply use the shortcode [geolocation_map_all]