Implementing MarkerClusterer.js into my WordPress.org Theme

196 views
Skip to first unread message

Edward

unread,
Jan 7, 2012, 3:09:31 PM1/7/12
to Google Maps JavaScript API v3
Good afternoon all,

I know this is probably the million+1 post regarding the
MarkerClusterer ability of GMap3. I have done some extensive research
on a lot of these posts, but have yet to make it work for my
particular WordPress Theme, found here:
http://themeforest.net/item/the-navigator-premium-wp-location-guide-blog/397351

The theme seems to call out the map in the header and uses the "Post"
function in WP to input the individual markers into the database.

I am a newbie, but am going to try to offer as much info as possible
here.

I am running locally (Which may be my initial issue?), but will
eventually upload to a server (which will eventually be the fix?).

I have downloaded two different types of MarkerClusterer.js. One uses
the example code provided in Googles documentation, while the other is
a compressed version of the code. I have tried both.
The Gmap3.min.js uses compressed coding if that helps?

I have called out the js in the header.PHP: "<script type="text/
javascript" src="<?php echo get_template_directory_uri(); ?>/scripts/
markerclusterer.js"></script>"

After which I was under the impression that I needed to call out my
parameters...? My simplified parameter below:
"<script type="text/javascript">
Var map;
function initialize() {
markerCluster = new MarkerClusterer(map, gmarkers);
mm.addMarkers(gmarkers,0,1000);
mm.refresh();
}
</script>"

I am trying to figure out if this template is an exception to the
clustering or if I need to go about this in another way... OR I am way
off base with what I am trying to perform.

I am new with this, so please excuse me if this looks like it was
written in crayon by a three year old...

Kind Regards,
Edward

Rossko

unread,
Jan 7, 2012, 5:25:51 PM1/7/12
to Google Maps JavaScript API v3
> but have yet to make it work for my
> particular WordPress Theme, found here:
> http://themeforest.net/item/the-navigator-premium-wp-location-guide-b...

I think you'd need to find out how to get an array of markers out of
the theme, and a way to suppress having the theme add them to the map,
so that you can have the cluster manage them instead. That may get
tricky.

I can think of two easier ways forward
Ask the theme developer to add clustering capability.
Ditch the theme and write your own code - having got this far you
might find it easier than you expect.

> function initialize() {
>         markerCluster = new MarkerClusterer(map, gmarkers);
>         mm.addMarkers(gmarkers,0,1000);
>         mm.refresh();}

What is 'mm'? What is 'gmarkers'?
Snippets out of context don't help much here

Edward

unread,
Jan 8, 2012, 9:30:23 AM1/8/12
to Google Maps JavaScript API v3
Rossko,

Thank you for your candor! I was hoping for an easier route, but
thought I might find an answer like this.

I thought there may be an issue with pulling in and organizing the
data, but am not familiar enough with the entire process to know
exactly how it was managed with this particular theme.

It would be ideal to start from scratch, but the resources for this
project are minimal... I am sure many here can feel my pain :) If this
works out though, I may be able to pitch the idea to receive state
funding Pipe dream? Hope not...)

The "mm" was one of several code snippets that I "sampled" to try to
make this work. Arbitrary code at this point I think.

I would absolutely welcome more input on that if anyone would be
willing - Even if they had an alternate theme that might fill my needs
(I will have POI's, Bounds and trails eventually. The present theme
only supports POI's)

Kind Regards,
Edward
Reply all
Reply to author
Forward
0 new messages