Home Forums Plugin Support WP User Frontend Pro Google Map Lang-Long

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  noomia 5 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4618

    Mitrich
    Participant
    Post count: 1

    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?

    #4620

    Tareq Hasan
    Keymaster
    Post count: 2831

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

    #4623

    Mitrich
    Participant
    Post count: 1

    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!

    #4642

    noomia
    Participant
    Post count: 115

    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' );
    #4725

    noomia
    Participant
    Post count: 115

    Does it help ๐Ÿ™‚ ?

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Google Map Lang-Long’ is closed to new replies.