ÿþ<?php use AIOS\Listings\Classses\aios_template_api; use AIOS\Listings\Classses\Constant; $listing = aios_template_api::details_page(get_the_ID()); $listing = json_decode($listing); $options = $listing->options; $currArr = Constant::currency(); $listingDetails = $listing->listing; $listingDetailsMeta = maybe_unserialize($listing->meta->_listing_details[0]); $listingDetailsImages = (isset($listing->meta->listing_gallery[0])) ? maybe_unserialize($listing->meta->listing_gallery[0]) : []; $listingDetailsTaxonomy = maybe_unserialize($listing->taxonomy); $listingLocationInfo = maybe_unserialize($listing->meta->_listing_location_information[0]); $listingInteriorFeatures = maybe_unserialize($listing->meta->_listing_interior_features[0]); $listingExteriorFeatures = maybe_unserialize($listing->meta->_listing_exterior_features[0]); $listingSchools = maybe_unserialize($listing->meta->_listing_schools[0]); $listingAdditionalInformation = maybe_unserialize($listing->meta->_listing_additional_information[0]); $listingDetailsOpenHouse = maybe_unserialize($listing->meta->_open_house[0]); $listingsGroupData = maybe_unserialize($listing->meta->_grouped_data[0]); $external_gallery = maybe_unserialize($listing->meta->_external_gallery[0]); $main_slider = ''; $thumb_slider = ''; $popup_gallery_main = ''; $popup_gallery_thumb = ''; $popup_gallery_counter = 0; foreach ($external_gallery as $photo) { $main_slider .= ' <div class="main-photo-item" data-id="' . $popup_gallery_counter . '"> <div class="img-wrap main-photo-img-wrap"> <canvas class="lazyload" width="809" height="575"></canvas> <img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="' . $photo . '" alt="Property Photo" class="lazyload" width="809" height="575"> </div> </div>'; $thumb_slider .= ' <div class="sub-photo-item"> <div class="img-wrap main-photo-img-wrap"> <canvas class="lazyload" width="152" height="90"></canvas> <img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="' . $photo . '" alt="Property Photo" class="lazyload" width="152" height="90"> </div> </div>'; $popup_gallery_main .= ' <div class="main-photo-item"> <div class="img-wrap main-photo-img-wrap"> <canvas class="lazyload" width="809" height="575"></canvas> <img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="' . $photo . '" alt="Property Photo" class="lazyload" width="809" height="575"> </div> </div>'; $popup_gallery_thumb .= ' <div class="sub-photo-item"> <div class="img-wrap main-photo-img-wrap"> <canvas class="lazyload" width="152" height="90"></canvas> <img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="' . $photo . '" alt="Property Photo" class="lazyload" width="152" height="90"> </div> </div>'; $popup_gallery_counter++; } $surface_measurement = $listingsGroupData['surface_measurement']; $surface_measurement = ($surface_measurement == 'M2' ? 'm<sup>2</sup>' : $surface_measurement); $tags = get_post_meta(get_the_id(), 'tags', true); $services = []; $spaces = []; $additionals = []; $pets_allowed = ''; foreach ($tags as $tag) { if ($tag['type'] == '1') { $services[] = $tag['name']; } elseif ($tag['type'] == '2') { $spaces[] = $tag['name']; } elseif ($tag['type'] == '3') { $additionals[] = $tag['name']; } // Check for 'Pets Allowed' if (strtolower(trim($tag['name'] ?? '')) == 'pets allowed') { $pets_allowed = $tag; } } $features = [ 'services' => $services, 'spaces' => $spaces, 'additionals' => $additionals, ]; $prices = []; if ($listingDetailsMeta['list_price']) { $prices[] = 'USD ' . number_format($listingDetailsMeta['list_price']); } if ($listingDetailsMeta['mxn_price']) { $prices[] = 'MXN ' . number_format($listingDetailsMeta['mxn_price']); } $videos = get_post_meta(get_the_id(), '_videos', true); function youtubeEmbed($url) { preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match); $new_url = 'https://www.youtube-nocookie.com/embed/' . $match[1] . '?rel=0&controls=1&showinfo=0&enablejsapi=1'; return $new_url; } if ($videos[0]) { $video_embed_url = $videos[0]['player_url']; $video_url = $videos[0]['url']; if (strpos($video_url, 'youtube') !== false) { $video_embed_url = youtubeEmbed($video_url); } } $property_basic_information = get_post_meta( get_the_id(), 'property_basic_information', true ); $property_basic_information = is_array( $property_basic_information ) ? $property_basic_information : []; $basic_information = []; $surface_area = []; if ( $property_basic_information['spaces'] ) $basic_information['spaces'] = $property_basic_information['spaces']; if ( $property_basic_information['bedrooms'] ) $basic_information['bedrooms'] = $property_basic_information['bedrooms']; if ( $property_basic_information['bathrooms'] ) $basic_information['bathrooms'] = $property_basic_information['bathrooms']; if ( $property_basic_information['garages'] ) $basic_information['garages'] = $property_basic_information['garages']; if ( $property_basic_information['condition'] ) $basic_information['condition'] = $property_basic_information['condition']; if ( $property_basic_information['floors'] ) $basic_information['floors'] = $property_basic_information['floors']; if ( $property_basic_information['age'] ) $basic_information['age'] = $property_basic_information['age'] . ' Years' ; if ( $property_basic_information['credit'] ) $basic_information['credit'] = $property_basic_information['credit']; if ( (float) $property_basic_information['land_area'] ) $surface_area['land_area'] = (int) $property_basic_information['land_area'] . ' ' . $property_basic_information['surface_unit_label'] ; if ( (float) $property_basic_information['roof'] ) $surface_area['roof'] = (int) $property_basic_information['roof'] . ' ' . $property_basic_information['surface_unit_label'] ; if ( (float) $property_basic_information['total_built_area'] ) $surface_area['total_built_area'] = (int) $property_basic_information['total_built_area'] . ' ' . $property_basic_information['surface_unit_label'] ; if ( (float) $property_basic_information['front'] ) $surface_area['front'] = (int) $property_basic_information['front'] . ' ' . $property_basic_information['surface_unit_label'] ; if ( (float) $property_basic_information['depth'] ) $surface_area['depth'] = (int) $property_basic_information['depth'] . ' ' . $property_basic_information['surface_unit_label'] ; get_header(); ?> <div class="ip-pd-wrap"> <div class="ip-breadcrumbs-container"> <?php if (function_exists('yoast_breadcrumb')) { yoast_breadcrumb('<p id="breadcrumbs">', '</p>'); } ?> </div> <div class="ip-sec main-sec"> <div class="right-col"> <h1 class="prop-title-desc"> <?= ($listingDetailsMeta['full_address'] ? $listingDetailsMeta['full_address'] : get_the_title()) ?> </h1> <div class="main-photo-slider" id="main-photo-slider"> <?= $main_slider ?> </div> <div class="sub-photo-slider" id="sub-photo-slider"> <?= $thumb_slider ?> </div> <div class="additional-info"> <?php if ( $basic_information ) : ?> <div class="additional-info--col"> <div class="prop-specs-title">Basic Information</div> <ul> <?php foreach ( $basic_information as $label => $value ) : ?> <li> <strong><?= ucwords( $label ) ?>:</strong> <span><?= $value ?></span> </li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <?php if ( $surface_area ) : ?> <div class="additional-info--col"> <div class="prop-specs-title">Surfaces</div> <ul> <?php foreach ( $surface_area as $label => $value ) : ?> <li> <strong><?= ucwords( str_replace( '_', ' ', $label ) ) ?>:</strong> <span><?= $value ?></span> </li> <?php endforeach; ?> </ul> </div> <?php endif; ?> </div> <div class="map-wrap"> <div class="map-img-wrap"> <canvas class="lazyload" width="810" height="530"></canvas> <div id="custom_map" data-lat="<?= $listingDetailsMeta['map_latitude'] ?>" data-lng="<?= $listingDetailsMeta['map_longitude'] ?>" data-address="<?= $listingDetailsMeta['full_address'] ?>"></div> </div> </div> <?php if ($video_embed_url) : ?> <div class="video-wrap"> <div class="video-img-wrap"> <canvas class="lazyload" width="810" height="530"></canvas> <iframe src="<?= $video_embed_url ?>"></iframe> </div> <div class="site-btn-wrap agent-btn-wrap"> <div class="site-btn dark"> <a href="#virtual_tour_popup" class="open-vt aios-content-popup"> <div>click to enlarge video</div> </a> </div> </div> <div id="virtual_tour_popup" class="aiosp-hide virtual_tour_popup"> <iframe src="<?= $video_embed_url ?>"></iframe> </div> </div> <?php endif; ?> <div class="details-wrap"> <div class="details-row"> <h2 class="details-title"> Description </h2> <div class="details-desc"> <?= $listingDetails->post_content ?> </div> </div> <?php foreach ($features as $groupKey => $groupValue) : ?> <?php if ($groupValue) : ?> <?php $groupValue = array_chunk($groupValue, ceil(count($groupValue) / 3)); ?> <div class="details-row"> <h2 class="details-title"> <?= ucwords($groupKey) ?> </h2> <div class="details-list-wrap"> <?php foreach ($groupValue as $group) : ?> <ul> <?php foreach ($group as $tag) : ?> <li><?= $tag ?></li> <?php endforeach; ?> </ul> <?php endforeach; ?> </div> </div> <?php endif; ?> <?php endforeach; ?> </div> </div> <div class="left-col"> <div class="prop-address-wrap"> <h2 class="prop-address"> <!--?= ( $listingDetailsMeta['full_location'] ? $listingDetailsMeta['full_location'] : get_the_title() ) ?--> <!-- <?= get_the_title() ?> --> <?php $full_location = $listingDetailsMeta['full_location']; if (strpos($full_location, '|') !== false) { $full_location = explode('|', $full_location); /*get the second to the last item from the location field*/ // $city = ( $full_location[ (count($full_location) - 2) ] ? $full_location[ (count($full_location) - 2) ] : '' ); // echo $city; array_shift($full_location); $reversed_full_location = array_reverse($full_location); $new_full_location = implode(', ', array_map('trim', $reversed_full_location)); echo $new_full_location; } ?> </h2> </div> <?= ($listingDetailsMeta['featured_property'] ? '<div class="prop-status">Exclusive</div>' : '') ?> <?= (isset($listingDetailsTaxonomy->property_statuses[0]) ? '<div class="prop-status">' . $listingDetailsTaxonomy->property_statuses[0]->name . '</div>' : '') ?> <div class="prop-specs-title">Property</div> <ul class="prop-specs prop-specs--alt"> <?php if ($listingDetailsTaxonomy->property_types) : ?> <li> <span>Property Type</span> <strong><?= implode(', ', wp_list_pluck($listingDetailsTaxonomy->property_types, 'name')) ?></strong> </li> <?php endif; ?> <li class="hidden"> <span>Zone</span> <strong><?= get_the_title() ?></strong> </li> <?php if ($listingDetailsMeta['address_city']) : ?> <li> <span>Location</span> <strong><?= $listingDetailsMeta['address_city'] ?></strong> </li> <?php endif; ?> <?php if ($listingDetailsMeta['details_bedrooms']) : ?> <li> <span>Bedrooms</span> <strong><?= $listingDetailsMeta['details_bedrooms'] ?></strong> </li> <?php endif; ?> <?php if ($listingDetailsMeta['details_bathrooms']) : ?> <li> <span>Bathrooms</span> <strong><?= $listingDetailsMeta['details_bathrooms'] ?></strong> </li> <?php endif; ?> <?php if ($pets_allowed) : ?> <li> <span>Pets</span> <strong>Pets Allowed </strong> </li> <?php endif; ?> <?php if ($listingDetailsMeta['pending_sale']) : ?> <li> <span></span> <strong>Pending Sale</strong> </li> <?php endif; ?> <?php if ($property_basic_information['covered_area']) : ?> <li> <span>Covered Area</span> <strong><?= $property_basic_information['covered_area'] . ' ' . $property_basic_information['surface_unit_label'] ?></strong> </li> <?php endif; ?> <?php if ($property_basic_information['plants']) : ?> <li> <span>Plants</span> <strong><?= $property_basic_information['plants'] ?></strong> </li> <?php endif; ?> <?php if ($property_basic_information['antiquity']) : ?> <li> <span>Antiquity</span> <strong><?= $property_basic_information['antiquity'] ?></strong> </li> <?php endif; ?> </ul> <div class="prop-specs-title">Financials</div> <ul class="prop-specs prop-specs--alt"> <?php if ($prices) : ?> <li> <span>Price</span> <strong><?= implode('<br>', $prices) ?></strong> </li> <?php endif; ?> <?php if ($listingDetailsMeta['financing_property']) : ?> <li> <span></span> <strong>Financiamiento Postventa</strong> </li> <?php endif; ?> </ul> <div class="site-btn-wrap download-pdf-btn-wrap"> <div class="site-btn download-pdf-btn dark"> <a href="?printable_flyer=true" target="_blank"> <div>Download PDF</div> </a> </div> </div> <?php $producer = maybe_unserialize($listing->meta->producer[0]); ?> <?php if ($producer) : ?> <?php $default_agent = 7111;/*karina*/ $agent_args = [ 'post_type' => 'aios-agents', 'posts_per_page' => 1, 'meta_query' => [ 'relation' => 'OR', [ 'key' => 'producer_email', 'value' => $producer['email'], 'compare' => 'LIKE', ], ], ]; $agent_query = new WP_Query($agent_args); $agent_id = $agent_query->posts[0] ? $agent_query->posts[0]->ID : $default_agent ; ?> <?php if ($agent_id) : ?> <?php $agent_details = get_post_meta($agent_id, '_agent_details', true); $photo = wp_get_attachment_image_url($agent_details['agentimage_id'], 'full'); $photo = $photo ? $photo : 'https://cdn.agentimagehosting.com/Pd86WPaBce9taRyp0sBNT/2025/04/pr_logo.jpg' ; ?> <div class="agent-wrap"> <div class="img-wrap agent-img-wrap"> <canvas class="lazyload" width="170" height="192"></canvas> <img src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=" data-src="<?= $photo ?>" alt="Agent Photo" class="lazyload" width="170" height="192"> </div> <div class="agent-details"> <div class="agent-name"> <?= $agent_details['first_name'] . ' ' . $agent_details['last_name'] ?> </div> <div class="agent-pos"> <?= $agent_details['position'] ?> </div> <ul class="agent-contact"> <?php $producer_cellphone = trim($producer['cellphone']) ; $producer_phone = trim($producer['phone']) ; // $producer_cellphone_txt = $producer_cellphone ? aios_remove_country_code( $producer_cellphone ) : ''; // $producer_phone_txt = $producer_phone ? aios_remove_country_code( $producer_phone ) : ''; ?> <?= ($producer_cellphone ? '<li>' . do_shortcode('[ai_phone href="' . $producer_cellphone . '"]+' . $producer_cellphone . '[/ai_phone]') . '</li>' : '') ?> <?= ($producer_phone ? '<li>' . do_shortcode('[ai_phone href="' . $producer_phone . '"]+' . $producer_phone . '[/ai_phone]') . '</li>' : '') ?> <li data-wg-notranslate><?= do_shortcode('[mail_to email="' . $producer['email'] . '"]' . $producer['email'] . '[/mail_to]')?></li> </ul> <div class="site-btn-wrap agent-btn-wrap"> <div class="site-btn agent-btn dark"> <a href="<?= get_the_permalink($agent_id) ?>"> <div>Know More</div> </a> </div> </div> </div> </div> <?php endif; ?> <?php endif; ?> <div class="form2-wrap"> <div class="form2-title">Contact</div> <?= do_shortcode('[contact-form-7 title="Interested In Listings Custom v2" html_class="use-floating-validation-tip"]')?> </div> <div class="site-arrow-wrap details-arrow-wrap hidden"> <a href="#" class="slide-arrow photo-prev"> <span class="ai-font-arrow-g-p"></span> <span class="hidden">arrow</span> </a> <a href="#" class="slide-arrow photo-next"> <span class="ai-font-arrow-g"></span> <span class="hidden">arrow</span> </a> </div> </div> </div> <div class="ip-sec form-map-sec hide"> <div class="form-map-wrap"> <div class="left-col"> <div class="form-wrap"> <div class="form-title"> <span>Interested In</span> <?= ($listingsGroupData['address'] ? $listingsGroupData['address'] : get_the_title()) ?> </div> <div class="form-inner-wrap"> <?= do_shortcode('[contact-form-7 id="8d71f51" title="Interested In Listings Custom" html_class="use-floating-validation-tip"]')?> </div> </div> </div> <div class="right-col"> </div> </div> </div> <div id="popup-gallery" class="aiosp-hide"> <div class="main-photo-slider" id="popup-main-photo-slider"> <?= $popup_gallery_main ?> </div> <div class="sub-photo-slider hidden" id="popup-sub-photo-slider"> <?= $popup_gallery_thumb ?> </div> </div> <a href="#popup-gallery" class="aios-content-popup sr-only">Popup Gallery</a> <?php $property_types = wp_list_pluck($listingDetailsTaxonomy->property_types, 'slug'); $property_types = implode('|', $property_types); $similar_properties = do_shortcode(' [tokkobroker_listings_widgetized property_types="' . $property_types . '" address_city="' . $listingDetailsMeta['address_city'] . '" limit="12" full_location_repeater_label="<li>{{value}}</li>" beds_label="<li><span class=\'ai-font-bed-a\'></span> {{value}} </li>" baths_label="<li><span class=\'ai-font-showers\'></span> {{value}} </li>" sqft_label="<li><span class=\'ai-font-house\'></span> {{value}} </li>" exclusive_banner_label="<span>{{value}}</span>" status_banner_label="<span>{{value}}</span>" ] <div class="results-item"> <a href="{{permalink}}"> <div class="img-wrap results-img-wrap"> <canvas class=" lazyloaded" width="340" height="241"></canvas> <img src="{{image}}" alt="Results Photo" class=" lazyloaded" width="340" height="241"> <div class="results-status"> {{exclusive_banner}} {{status_banner}} </div> </div> <div class="results-details"> <div class="results-address"> <h2> {{address}} </h2> </div> <ul class="results-address-type"> {{full_location}} </ul> <div class="results-price"> {{price_group}} </div> <div class="results-type-specs-wrap"> <div class="results-type">{{property_type}}</div> <ul class="results-specs"> {{beds}} {{baths}} {{sqft}} </ul> </div> <div class="results-id-logo"> <div class="results-id"> <span>LISTING ID </span>#{{listing_id}} </div> <img src="https://cdn.agentimagehosting.com/Pd86WPaBce9taRyp0sBNT/2025/04/Logo-PR.png" data-src="https://cdn.agentimagehosting.com/Pd86WPaBce9taRyp0sBNT/2025/04/Logo-PR.png" alt="Results Logo" class=" lazyloaded" width="46" height="30"> </div> </div> </a> </div> [/tokkobroker_listings_widgetized] '); ?> <?php if ($similar_properties) : ?> <div class="agent-listings"> <h2>PROPERTIES YOU MAY BE INTERESTED IN</h2> <div class="results-inner flex-row"> <?= $similar_properties ?> </div> </div> <?php endif; ?> </div> <div class="popup-gallery-grid"> <div class="popup-gallery-grid-close ai-font-close-c"></div> <div class="popup-gallery-grid-wrapper"> <div class="popup-gallery-grid-holder"> <?= $main_slider ?> </div> </div> </div> <?php get_footer(); ?>