Posted by: bugambilia | October 16, 2007

Show multiple locations on one map with geo-mashup wordpress plugin

Geo-mashup is a plugin that uses Google maps to map your posts and pages. You can find it here along with other mapping plugins http://codex.wordpress.org/Plugins/Geo

My goals was to have:

  • my default WordPress home page have a map showing the world
  • pins/markers on that map linking to all pages/posts with map coordinates

I followed the instruction for Quick Start: Adding a Geo Mashup page #3 from here http://code.google.com/p/wordpress-geo-mashup/wiki/Documentation. I later found this was not necessary because I had to remove the code from the map page in order to use the Template Tags, which you need to show all the post/page locations.

The Geo-mashup instructions are vague in some parts. You’ll need to know the following:

The Loop, read what it is here http://codex.wordpress.org/The_Loop

I’m using the WordPress Classic 1.5 theme and running WordPress 2.3, so I edited index.php instead of the page.php used in other templates. It is located in the Administration Panel > Presentation > Theme Editor and edit Main Index Template.

Next, you’ll need to add this line in “the loop” <?php GeoMashup::the_map() ?> I put it near the top:

<?php
get_header();
?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php the_date('','<h2>','</h2>'); ?>

<?php GeoMashup::the_map() ?> HERE

Remember to update file.

www.yoursite.com vs. //yoursite.com and the redirect. I did not use the redirect plugin mentioned in the geo-mashup instructions. Pages on my site redirected automatically when I typed in www.yoursite.com to //yoursite.com. My settings in the Administration Panel > Options > General are:

WordPress address (URL): http://yoursite.com

Blog address (URL): http://yoursite.com

I’m not sure if this is the reason for the automatic redirect. This was a major issues when I used Gallery2, I had to redirect or send links that said go to http://www.yoursite.com and hoped they clicked the link.

After figuring all that out, pins/markers were still not showing. From reading a few posts ( http://www.cyberhobo.net/downloads/geo-mashup-plugin/ read # 104-108) it could’ve been that I was impatient and takes a while for the something to be recognized. This might be the last step needed.

In hindsight I should’ve waited a bit. But in my desperation :P I also changed the setting for the markers in the Administration Panel > Options > Geo Mashup

Hide Markers Until Zoom Level 0 (max zoom out) – 17 (max zoom in)

By default the level is blank, I figured it would be good to see markers when the map is zoomed out all the way so I put in zero. When I reloaded the page the markers showed up. Like I said, this might not have anything to do with the markers showing. But it worked for me.

**UPDATE: Just updated to WP 2.3.1 and geo-mashup runs fine (11/15/07)**


Categories