wpcasa icon indicating copy to clipboard operation
wpcasa copied to clipboard

Check map location with admin map UI enabled

Open simonrimkus opened this issue 8 years ago • 1 comments

A user noticed a difference between the marked location in the admin with the marker shown on the front end. In this case there were no street names etc.

/**
 * Template: Single Listing Location
 */
global $listing;

$lat  = get_post_meta( $listing->ID, '_geolocation_lat', true );
$long = get_post_meta( $listing->ID, '_geolocation_long', true );

$hide = get_post_meta( $listing->ID, '_map_hide', true );
    
$map_location = get_post_meta( $listing->ID, '_map_geolocation', true );

if( ! empty( $map_location ) && is_array( $map_location ) ) {

    $map_lat    = isset( $map_location['lat'] ) ? $map_location['lat'] : false;
    $map_long   = isset( $map_location['long'] ) ? $map_location['long'] : false;
    
    if( $map_lat && $map_long ) {
        $lat    = $map_lat;
        $long   = $map_long;
    }

}

simonrimkus avatar May 19 '16 06:05 simonrimkus