Ejemplo n.º 1
0
$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
        $current_prop_array['url'] = get_permalink();
        // Property Map Icon Based on Property Type
        $property_type_slug = 'single-family-home';
        // Default Icon Slug
        $temp_property_type_slug = $map_property->get_taxonomy_first_term('property-type', 'slug');