1. Home
  2. WP User Frontend Pro
  3. Integrations
  4. WP Geo

WP Geo

This is an integration with WP Geo plugin.

Paste this snippet in your themes functions.php and insert a google map field with meta key location_map. If you want to put geo title, insert a custom text field with the meta key geo_title in the form.

function wpufe_update_wp_geo( $post_id ) {
    if ( isset( $_POST['location_map'] ) ) {
        list( $lat, $long ) = explode(',', $_POST['location_map']);

        update_post_meta( $post_id, WPGEO_LATITUDE_META, $lat );
        update_post_meta( $post_id, WPGEO_LONGITUDE_META, $long );
    }

    if ( isset( $_POST['geo_title'] ) ) {
        update_post_meta( $post_id, WPGEO_TITLE_META, $_POST['geo_title'] );
    }
}

add_action( 'wpuf_add_post_after_insert', 'wpufe_update_wp_geo' );
add_action( 'wpuf_edit_post_after_update', 'wpufe_update_wp_geo' );

Was this article helpful to you? Yes 8 No 4

How can we help?