Up to 50 percent off

Google Map Lang-Long

This topic contains 4 reply and 3 voices, and was last updated by noomia 11 years, 5 months ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
June 6, 2013 at 2:53 pm 4618
noomia Is there any way to place the Google Map coordinates for lang. ang long. NOT as one custom field separated by comma, but as two separeate custom fields?
June 6, 2013 at 5:32 pm 4620
Tareq Hasan Tareq Hasan

Nope, unless you customize your own function for doing it.

June 6, 2013 at 5:40 pm 4623
Mitrich Mitrich

I am new to PHP and would highly appreciate if you could give me a piece of code or a hint hoe to do it… I really need it badly.
And – I should have started with that 🙂 – thank you for the great plugin. It worth the money you ask for it, that is for sure!

June 7, 2013 at 8:19 am 4642
noomia noomia

Maybe this can help 🙂

/************************************************************************/
/* Save Lat & Lng Value Into Two Custom Fields	
/************************************************************************/
function wpufe_latlng_address( $post_id ) {
    if ( isset( $_POST['address'] ) ) { //If address...
    	$latlong = $_POST['address'];
    	list( $def_lat, $def_long ) = explode( ',', $latlong ); //Put the value before ',' in $def_lat and the value after ',' in $def_long
        
        update_post_meta( $post_id, 'lat', $def_lat ); //Put $def_lat in the 'lat' custom field
        update_post_meta( $post_id, 'long', $def_long ); //Put $def_long in the 'long' custom field
    }
}
add_action( 'wpuf_add_post_after_insert', 'wpufe_latlng_address' );
add_action( 'wpuf_edit_post_after_update', 'wpufe_latlng_address' );
June 10, 2013 at 8:01 am 4725
noomia noomia

Does it help 🙂 ?

Viewing 4 Posts - 1 through 4 (of 4 total)