thydzikGoogleMap v1.4.5 – an inline Google map plugin for WordPress

thydzikGoogleMap v1.4.5 is now available with significant improvements, including

  • The Google Maps Javascript and thydzikGoogleMap Javascript is downloaded only as needed, speeding up page loading of all pages without maps.
  • Removal of <head> code means thydzikGoogleMap will only be present when called.
  • Compressed thydzikGoogleMap code.
  • Multiple maps can now be created in a single post!
  • Map type can be changed from default by providing an additional ‘map type’ parameter.

thydzikGoogleMap produces valid XHTML and allows for easy creation of Google Maps in your WordPress posts from XML map data.

Grab the latest from the WordPress repository.

Examples of the newest functionality below:

Using either: Normal, G_NORMAL_MAP, N or left out; i.e. thydzikGoogleMap(example.xml), thydzikGoogleMap will produce a default styled map

thydzikGoogleMap(example.xml)

Using either: SATELLITE, G_SATELLITE_MAP, S; i.e. thydzikgooglemap(example.xml, 4, S), thydzikGoogleMap will produce a satellite styled map. Note I have included a zoom of 4, and used the abreviation ‘S’.

thydzikgooglemap(example.xml, 4, S)

Using either: HYBRID, G_HYBRID_MAP, H; i.e. tHyDzIkGoOgLeMaP(example.xml,hYbRiD,450,225), thydzikGoolgeMap will produce a hybrid styled map. Note I have included a width and height, and proved that capitalisation is not of concern.

tHyDzIkGoOgLeMaP(example.xml, hYbRiD, 450,225)

Finally, using either: PHYSICAL, G_PHYSICAL_MAP, P, TERRAIN or T; i.e thydzikGoogleMap(example.xml,TERRAIN), thydzikGoogleMap will produce a terrain styled map.

thydzikGoogleMap(example.xml,TERRAIN)

As always, comments and suggestions welcome. In a future update I will try to incorporate rounded corners :)

thydzikGoogleMap v1.4

thydzikGoogleMap version 1.4 has been released with two major improvements.

  1. Manual zoom parameter added. Google uses an integer value from 0 to 17 (where 0 is the furthest away), to determine the map’s zoom level, this value can now be incorporated into thydzikGoogleMap as follows: thydzikGoogleMap(example.xml, 4). The zoom is an optional parameter and if left out the automatic zoom calculation will be used as before. The width and height of the map can still be added if desired as thydzikGoogleMap(example.xml, 4, 480, 640) or thydzikGoogleMap(example.xml, 480, 640, 4).
  2. The thydzikGoogleMap code is disabled if the site is viewed from a proxy, i.e. Google cache. Before a user viewing the blog would receive ‘The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/.’ thydzikGoogleMap now detects this and disables the maps.

Example with the new zoom functionality

thydzikGoogleMap(example.xml, 4)

Future improvements will include

  • Option of choosing Map, Satellite or Terrain
  • Disabling all code if no thydzikGoogleMap are present
  • Creating multiple maps in a single blog post

Grab the latest from the WordPress repository.

thydzikGoogleMap v1.3.1

thydzikGoogleMap v1.3.1 has been released, with 2 improvements.

  1. Fixed a problem with cross domain xml files. As reported by Erik on thydzikGoogleMap support forum.
  2. Added improved output for when directly calling thydzikGoogleMap.php

Before Google bots would have picked it up as

Fatal error: Call to undefined function get_option() in /home ...

Now Google will see:

thydzik.com are proudly using the WordPress plugin thydzikGoogleMap
 to display inline Google maps on their blog.

Where thydzik.com is the WordPress user’s domain including link.

Finally, a small note about upgrading thydzikGoogleMap. WordPress has the option of automatically upgrading, which is very handy; unfortunately this overwrites any XML files you may have been storing in the plugin directory. So it is a better idea to keep all your XML maps in a separate location.

thydzikGoogleMap version 1.3.1

thydzikGoogleMap v1.3

I have finally managed to get WordPress to update the version number. This problem was due to not updating the version number in the PHP file as well as the readme.txt.

Version 1.3 fixes a problem with thydzikGoogleMap not displaying correctly when a WordPress blog isn’t located in the domain folder.

I have seen a few users, using thydzikGoogleMap to display a single point or no points at all, thydzikGoogleMap isn’t really for this as it is not worth creating an XML file just for the single point. Plus I believe you can now simply embed a Google map with some simple code.

However, if you want full customization; including lines, numbered points, HTML in a point’s detail, then thydzikGoogleMap is exactly for you.

Comments and suggestions very welcome.

Download thydzikGoogleMap v1.3

Karratha Geocaches (Pilbara, Western Australia)

From time to time I would like to share some of my Australian travels. It doesn’t really fit in technology or projects. Karratha is 1535km north of Perth, Western Australia.

The XML for the map below was made with RoboGEO, which synchronises GPS data with photographs using the timestamp. The XML map data was then displayed as a Google map using my WordPress plugin thydzikGoogleMap.

One of the features of thydzikGoogleMap is the ability to show XML Google maps, while maintaining the internal links to photographs.

thydzikGoogleMap(http://thydzik.com/geocaching/karratha-mar08/karratha-mar08.xml)

thydzikGoogleMap v1.1

thydzikGoogleMap v1.1 has been released with major updates:

  • cross-domain XML files can be used as the map data, see example below.
  • due to WordPress plugin repository automatically zipping plugins, the main plugin folder is changed. Anyone upgrading from v1.0, requires deletion of old folder.
  • Lots of code improvements, was a bug with displaying the default marker style.
  • Works with RoboGeo produced XML files.

The below example shows cross-domain support, I am using the XML file found in my second blog

http://sonyaandtravis.com/../china2007.xml

Download here

Add URL link to WordPress default header

Here is a quick post on how to add a URL link to your WordPress header. This has only been tested on the default theme. You will need to know the dimensions of the header; the default header is 760px by 200px. Note, you will need to disable Toggle Text Display, in WordPress Admin→Presentation→Header Image and Color→Advanced→Toggle Text Display.

Simply add the following code into header.php after <div id="header">

 <a href="<?php echo get_option('home'); ?>/" style="display:block;height: 200px;width: 760px"></a> 

With it inserted should look like the following:

<div id="header"><a href="<?php echo get_option('home'); ?>/" style="display:block;height: 258px;width: 760px"></a>
	<div id="headerimg">
		<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
		<div class="description"><?php bloginfo('description'); ?></div>
	</div>
</div>

An example blog with a linking header.

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