Create a Google Map using custom fields
My website:
http://www.maconlocalmarket.com/
is a local website that only accepts ads in one city and only at certain locations.
As such, I am trying to create a Google map using a custom field that has a dropdown box.
I created a custom field with cp_preferred_vendor_address and modified the sidebar-gmap.php to include the city and state as shown below the line.
However, this leads to the map disappearing in the post.
I did try a test form where I left in cp_street (Called Address in my form) as a non required option and left it blank and the map works fine.
To verify my findings, on my website I created two separate posts that are the same except that one had the cp_street option and the field was left blank.
http://www.maconlocalmarket.com/ads/adfgsdfg/
http://www.maconlocalmarket.com/ads/dafg/
Can anyone tell me why this is happening, and how I can get my maps to work without putting in an empty field? I think it will cause confusion on the site if I require my visitors to leave a field blank...
<div id="gmap" class="mapblock">
<?php
// check to see if ad is legacy or not and then assemble the map address
if ( get_post_meta($post->ID, 'location', true) )
$make_address = get_post_meta($post->ID, 'location', true);
else
$make_address = get_post_meta($post->ID, 'cp_preferred_vendor_address', true) . ' ' . "Macon" . ' ' . "Georgia" . ' ';
$coordinates = cp_get_geocode( $post->ID );
?>
- - - Updated - - -
Also, I am not sure if this belongs in the mods section or not, since it deals with the basic GMaps feature, but it is different from how the feature was intended. Please feel free to move the thread as needed.