Example #1
0
} elseif (is_tax()) {
    global $wp_query;
    /* Taxonomy Query */
    $map_args['tax_query'] = array(array('taxonomy' => $wp_query->query_vars['taxonomy'], 'field' => 'slug', 'terms' => $wp_query->query_vars['term']));
}
$map_query = new WP_Query($map_args);
$properties_data = array();
if ($map_query->have_posts()) {
    while ($map_query->have_posts()) {
        $map_query->the_post();
        $map_property = new Inspiry_Property(get_the_ID());
        $current_prop_array = array();
        // Property Title
        $current_prop_array['title'] = get_the_title();
        // Property Price
        $current_prop_array['price'] = $map_property->get_price();
        // Property Location
        $property_location = $map_property->get_location();
        if (!empty($property_location)) {
            $current_prop_array['lat'] = $map_property->get_latitude();
            $current_prop_array['lng'] = $map_property->get_longitude();
        }
        // Property Thumbnail
        if (has_post_thumbnail()) {
            $image_id = get_post_thumbnail_id();
            $image_attributes = wp_get_attachment_image_src($image_id, 'post-thumbnail');
            if (!empty($image_attributes[0])) {
                $current_prop_array['thumb'] = $image_attributes[0];
            }
        }
        // Property Permalink