Decomposing the Full Address
-
Greetings,
Right now I have a Frontend form where the user can enter their complete address in a field named “address”.
All these addresses are saved through this function:**************************************************** function gmw_update_location_via_wpuf( $post_id ) { //make sure we have post ID if ( !$post_id ) return; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } //change meta_field_name to the custom field of the address field _wppl_street $address = get_post_meta( $post_id, 'address', true ); $_wppl_street = get_post_meta( $post_id, '_wppl_street', true ); $phone = get_post_meta( $post_id, 'phone', true ); $fax = get_post_meta( $post_id, 'fax', true ); $email = get_post_meta( $post_id, 'email', true ); $website = get_post_meta( $post_id, 'website', true ); if ( empty( $address ) ) return; //include geocoder file include_once( GMW_PT_PATH .'/includes/gmw-pt-update-location.php' ); if ( function_exists( 'gmw_pt_update_location' ) ) { //setup geocoder args $args = array( 'post_id' => $post_id, 'post_title' => get_the_title( $post_id ), 'address' => $address, '_wppl_street' => $_wppl_street, 'additional_info' => array( 'phone' => $phone, 'fax' => $fax, 'email' => $email, 'website' => $website ) ); //run geocoder function gmw_pt_update_location( $args ); } } //update data of new post add_action('wpuf_add_post_after_insert', 'gmw_update_location_via_wpuf', 10, 1 ); //update data when post updated add_action('wpuf_edit_post_after_update', 'gmw_update_location_via_wpuf', 10, 1 ); ****************************************************
Now, I would prefer if the user enters his address but through multiple fields instead, like this:
street
apt
city
state
zipcode
countryMy Question is:
How could I modify the above code to use these fields instead of a single address field?Thanks in advance for your kind help,
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Decomposing the Full Address’ is closed to new replies.