• Hello,

    I can not get the “Posts Locator Function” gmw_update_post_location( $post_id, $address ); work with the Google Maps API Key. I followed your instruction https://docs.gravitygeolocation.com/article/134-how-to-create-browser-and-server-google-maps-api-keys to create 2 Keys, browser and server key.
    It does not work/update.
    When I use LeafLet it works fine. Even if I update with an Address string or an lat/lng array.

    So it must be something with the google API. And, I cant even find your TESTING Tab for checking if the API works ??

    I am Using the WPUF pro. And I use this funuction:

    function update_GEOmyWP( $post_id ) {
    	
    // make sure post ID exists.
    if ( ! $post_id ) {
    	return;
    }
    
    // verify the updater function.
    if ( ! function_exists( 'gmw_update_post_location' ) ) {
    	return;
    }
    	
    if ( isset( $_POST['aufnahmeort'] ) ) {
    	
    	list( $adresse, $lat, $lng ) = explode( '||', $_POST['aufnahmeort'] );
    	
    	$location = array( $lat, $lng );
    	
    	if ( $adresse ) {
    		update_post_meta( $post_id, 'newADDRESS', $adresse );
    	}
    	if ( $lat ) {
    		update_post_meta( $post_id, 'newLAT', $lat );
    	}
    	if ( $lng ) {
    		update_post_meta( $post_id, 'newLONG', $lng );
    	}
    
    	gmw_update_post_location( $post_id, $location );
    
    }
    }
    add_action( 'wpuf_add_post_after_insert', 'update_GEOmyWP' );
    add_action( 'wpuf_edit_post_after_update', 'update_GEOmyWP' );

    Please help ??
    Cheers,
    Denis

Viewing 1 replies (of 1 total)
  • Thread Starter DenisCGN

    (@deniscgn)

    UPDATE:

    well, I installed the BETA3 version, where I could find that browser and server key fields. And the google API check. The check was GOOD ??

    So now, I tried to use the ARRAY of lat and lng.

    But how is this ARRAY created?

    like this: $location = array( $lat, $lng ); the function does not work.

    When I use $location = $adresse; (address string) it works.

    How can I make it work with the lat lng?

    And, how das it work with $location_name? I thought it will take the Post Title. If I try to use $location_name = 'Hello'; nothing works again ??

    Thanks,
    Denis

    • This reply was modified 6 years, 2 months ago by DenisCGN.
    • This reply was modified 6 years, 2 months ago by DenisCGN.
Viewing 1 replies (of 1 total)
  • The topic ‘Posts Locator Function – Not working’ is closed to new replies.