Archive for the ‘site development’ Category

Yahoo! Static Maps Wordpress Plugin v0.101

Friday, February 2nd, 2007

Download this plugin

Description:
For a wordpress based project I’m working on, I wanted to include location maps that would load on my phone. This ruled out Google maps, because the API specifies that you have to load them via AJAX. Yahoo! has a Map Image API which doesn’t require javascript, allows for static maps, and even has an option to return the results as serialized PHP*.

So I grabbed the excellent Inline Google Maps plugin, tweaked it to use the Yahoo! API, and set it up to pull from custom fields instead of the image title tag.

Some of the obvious shortcomings that I will work on if possible, and if there is any interest:

  • I removed the multi-language support from Inline Google Maps
  • Yahoo Maps are US only
  • I did not include Zip Code support
  • Map always renders at the end of the post

I welcome comments, feature requests, etc. Please note that this is an 0.1 release, so it is quite likely to be buggy. I hope that it will be of use to someone other than just myself.

*the server I’m hosting the project on is running PHP 4.4, which doesn’t support the SimpleXML extension, and I only have one result to handle in each set, so unserialize() is nice to have.

Use:
Place yahoomaps.php in your plugins directory. Activate plugin.

Get a Yahoo! API Key.

Add these custom fields: Address, City, and State. I use Ryhmed Code’s Custom Field GUI plugin, but this can also be done manually.

Now, your post will have a Yahoo! map at the end, if Address, City, and State have all been filled in.