Address Geocoder WordPress Plugin
A simple WordPress plugin for saving location data with Posts and Pages. Conveniently converts addresses to lat/lng from the Edit screen.
Storing addresses as lat/lng (rather than geocoding each time a user requests a page) decreases load time. This plug-in makes it easy for content managers to generate lat/lng, which is stored with the post as a custom field that can be accessed as part of the loop.
Installation and Usage
- Get a copy of the plugin from WordPress.org or Github);
- Unzip and upload it to your /plugins directory;
- Activate the plugin from the Dashboard;
- You should now find a metabox labeled “Geocoder” on your Post and Page Edit screens. Enter an address in the address field (this can be an exact address or the name of a famous place — anything Google will understand);
- Press the “Geocode Address” button;
- The Lat/Lng field will populate with a lat/lng object and a map will appear in the preview box, with a marker on the location.
Access your data in the loop using the functions get_geocode_latlng() and get_geocode_address(), with the post ID passed as a parameter. Such as:
Lat/Lng: <?php echo get_geocode_latlng($post->ID); ?> Address: <?php echo get_geocode_address($post->ID); ?>
Issues and Support
If you need a hand or find a bug, please leave a comment here or, preferably, open a ticket on Github. Thanks!
Posted May 2012