thydzikGoogleMap – an inline Google map plugin for WordPress

thydzikGoogleMap is a WordPress plugin that creates inline Google maps in your WordPress posts. There are two main advantages over other existing Google maps plugins and they are:

  1. Ease of use, to create a Google map simply type thydzikGoogleMap(mapdata.xml, 600, 480) in your post on its own line.
  2. thydzikGoogleMap uses XML map data, this allows for maximum configurability, and supports multiple points and lines.

Please note, this is my first attempt at any ‘real’ php coding and my first attempt at creating a WordPress plugin. I am pretty sure I have not coded things optimally, the main thing is it does work. I have tried to minimise the return of errors and the plugin not working. Comments welcome on any suggestions or bugs.

thydzikGoogleMap(example.xml)

Few notes:

  • a markers folder is included with numbered pointers, these are used only when icon=”x” (where x is an integer), if this is excluded or pointers are alphabetical default Googles pointers will be used.
  • if width and height is excluded, the default width and height (460 and 345 respectively), found in the configuration page will be used.
  • thydzikGoogleMap automatically centres and zooms in on the points and lines, this may not always give the best results.
  • thydzikGoogleMap will produce a Google map only if the XML file is found, this was made so that examples i.e. thydzikGoogleMap(mapdata.xml) could be posted without producing a Google map.
  • thydzikGoogleMap searches post text using the_content and replaces valid thydzikGoogleMap with HTML and Javascript to produce a Google map. This might not be the best way to achieve this.
  • Only 1 Google map per post with be converted, however, multiple maps can exist when multiple posts are displayed.
  • thydzikGoogleMap produces valid XHTML.
  • thydzikGoogleMap has only been tested on the default Kubrick theme, WordPress version 2.3.2.

Download thydzikGoogleMap

  • Alexdan

    I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.