function save_postdata($post_ID) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || empty($_POST)) { return; } $this->ecm->_save_postdata(array('post_ID' => $post_ID, 'fields' => $this->ind_fields, 'edit_mode' => $this->edit_mode)); //if ( !get_post_meta( $post_ID, '_epl_location_long', true ) ) { $addr = esc_attr($_POST['_epl_location_address']); $city = esc_attr($_POST['_epl_location_city']); $state = esc_attr($_POST['_epl_location_state']); $country = esc_attr($_POST['_epl_location_country']); $geocode = epl_get_gmap_geocode("{$addr} {$city} {$state} {$country}"); if (empty($_POST['_epl_location_long']) && $geocode) { update_post_meta($post_ID, '_epl_location_lat', $geocode['lat']); update_post_meta($post_ID, '_epl_location_long', $geocode['long']); } //} }
<?php //This is an array with all the information from the db for the specific loaction in the loop global $location_details; $full_address = "{$location_details['_epl_location_address']} {$location_details['_epl_location_city']} {$location_details['_epl_location_state']} {$location_details['_epl_location_zip']}"; $_c = stripslashes_deep($location_details['post_content']); $_t = stripslashes_deep($location_details['post_title']); $lat = epl_get_element('_epl_location_lat', $location_details); $long = epl_get_element('_epl_location_long', $location_details); if ($lat == '' || $long == '') { $r = epl_get_gmap_geocode($full_address); extract($r); } ?> <script type="text/javascript"> var geocoder; var map; function codeAddress() { var myLatlng = new google.maps.LatLng(<?php echo $lat; ?> , <?php echo $long; ?> ); var myOptions = { zoom: 15, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP }