Cargando mapa
consultax:SELECT SQL_CALC_FOUND_ROWS wp_posts.*, ROUND( ( 6371 * acos( cos( radians(pm_lat.meta_value) ) * cos( radians( 40.656685 ) ) * cos( radians(-4.681209) - radians(pm_lng.meta_value)) + sin(radians(pm_lat.meta_value)) * sin( radians(40.656685)))), 1 ) AS `distance` FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_postmeta as pm_lng ON wp_posts.ID = pm_lng.post_id AND pm_lng.meta_key = 'property_longitude' LEFT JOIN wp_postmeta as pm_lat ON wp_posts.ID = pm_lat.post_id AND pm_lat.meta_key = 'property_latitude' WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (59) ) AND wp_posts.post_type IN ('estate_property', 'interesting_place') AND ((wp_posts.post_status = 'publish')) AND (SELECT meta_value FROM wp_postmeta WHERE meta_key='property_longitude' AND CAST(meta_value AS DECIMAL) AND post_id = wp_posts.ID GROUP BY post_id) BETWEEN -6.0287073189779 AND -3.3337098810221 AND (SELECT meta_value FROM wp_postmeta WHERE meta_key='property_latitude' AND CAST(meta_value AS DECIMAL) AND post_id = wp_posts.ID GROUP BY post_id) BETWEEN 39.30169232063 AND 42.006467864451 GROUP BY wp_posts.ID ORDER BY `distance` ASC, wp_posts.post_date DESC LIMIT 0, 21