I’ve been playing with the WordPress Geo Mashup plugin. It looks great, but I think that I am being a bit slow getting to grips with it…
I’ve found the following useful:
- The plugin page
- WordPress Geo Data page
- The tag references
- Some example code in PHP
- An example of interesting usage
I have learnt that:
[geo_mashup_map map_cat="9697" height="400" width="620"]
gives the same as:
<?php echo GeoMashup::map('height=400&width=620&map_cat=9697'); ?>
You can extract a meta data variable containing the category you want and pass it across with something like this:
$cat_1_value = get_post_meta(get_the_id(), 'CategoryToList', true);
$args = "cat=";
$args = $args . $cat_1_value;
$args = $args . "&posts_per_page=-1";
query_posts( $args );
When I did this I then discovered that I wanted to customize the icons / markers. This is relatively straightforward, but you need to add some stuff.
- Firstly, install the geo-mashup-custom plugin
- Then add a custom.js file to that directory to select the icon for whatever parameter you pass across.
- Then add some code in the functions.php file of your theme to extract the parameter that you want.
OK, I did say relatively straightforward, I didn’t say relative to what. I found the following useful, you will have to customise as appropriate to your theme:
One thing that I found was that the icons were coming out the wrong size, you need to set this in the custom.js file with something like:
object.icon.iconSize = [32, 37];
The more I use this plugin, the more I learn and the better it gets! There is a geo mashup search plugin too, download from here.