function manchester_custom_slideshow_captions($data) { if (is_array($data)) { unset($data['captions']); // each full represents a listing we need to work with. // their position in the array matches the other relavent // info. if (isset($data['listing'])) { foreach ($data['listing'] as $index => $listing) { // pls_dump($listing); /** Get the listing caption. */ ob_start(); ?> <div id="caption-<?php echo $index; ?> " class="orbit-html-caption"> <a href="<?php echo $listing['cur_data']['url']; ?> "><p class="address"><?php echo $listing['location']['full_address']; ?> </p></a> <p> <span class="beds"><?php echo $listing['cur_data']['beds']; ?> <?php _e('Beds', 'manchester'); ?> </span> <span class="baths"> <?php echo $listing['cur_data']['baths']; ?> <?php _e('Baths', 'manchester'); ?> </span> <span class="price"> <?php echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true)); if ($listing['cur_data']['lse_trms'] != null) { // translate lease terms to human form echo ' ' . PLS_Format::translate_lease_terms($listing); } ?> </span> </p> <a class="button b-blue large" href="<?php echo $listing['cur_data']['url']; ?> "><?php _e('See Details', 'manchester'); ?> </a> </div> <?php $data['captions'][] = trim(ob_get_clean()); } } } // error_log(var_export($data['captions'], true)); return $data; }
function manchester_custom_home_listing_list($listing_html, $listing_data) { // pls_dump($listing_data); ob_start(); ?> <section class="list-item"> <section class="list-pic"> <div class="thumbs"> <?php if (isset($listing_data['images']) && is_array($listing_data['images'])) { ?> <?php echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true)); ?> <?php } else { ?> <?php echo PLS_Image::load('', array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true)); ?> <?php } ?> </div> <?php if (isset($listing_data['rets']['mls_id'])) { ?> <p class="nrm-txt"><?php _e('MLS', 'manchester'); ?> #: <?php echo $listing_data['rets']['mls_id']; ?> </p> <?php } ?> </section> <section class="list-txt"> <section class="list-info"> <h5><a href="<?php echo $listing_data['cur_data']['url']; ?> "><?php echo $listing_data['location']['address']; ?> </a></h5> <h6><?php echo $listing_data['location']['locality']; ?> , <?php echo $listing_data['location']['region']; ?> </h6> <?php if (isset($listing_data['cur_data']['desc'])) { echo '<p class="nrm-txt">'; if (strlen($listing_data['cur_data']['desc']) < 150) { echo $listing_data['cur_data']['desc']; } else { $position = strrpos(substr($listing_data['cur_data']['desc'], 0, 150), ' '); echo substr($listing_data['cur_data']['desc'], 0, $position) . '...'; } echo '</p>'; } ?> <p class="nrm-txt"> <b><?php echo $listing_data['cur_data']['beds']; ?> </b> <span class="beds-n-baths"><?php _e('Beds', 'manchester'); ?> </span> | <b><?php echo $listing_data['cur_data']['baths']; ?> </b> <span class="beds-n-baths"><?php _e('Baths', 'manchester'); ?> </span> <?php if (isset($listing_data['cur_data']['sqft'])) { echo '| <b>' . PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false)) . '</b><span class="beds-n-baths"> ' . __('sqft', 'manchester') . '</span>'; } ?> </p> </section><!-- /list-info --> <section class="list-price"> <span class="green"><b><?php echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false)); ?> </b> <?php if ($listing_data['cur_data']['lse_trms'] != null) { // translate lease terms to human form echo PLS_Format::translate_lease_terms($listing_data); } ?> </span><br /> <span class="nrm-txt"> <?php if ($listing_data['property_type'] == "fam_home") { echo __("Single Family Home", 'manchester'); } else { $prop_type_frmttd = is_array($listing_data['property_type']) ? implode($listing_data['property_type']) : $listing_data['property_type']; echo ucwords($prop_type_frmttd); } ?> </span> </section><!-- /list-price --> <section class="list-links"> <!-- <section class="list-fav"><a href="#">Add to favorites</a></section> --> <?php $api_whoami = PLS_Plugin_API::get_user_details(); if (pls_get_option('pls-user-email')) { ?> <section class="list-req"> <a href="mailto:<?php echo pls_get_option('pls-user-email'); ?> " target="_blank"><?php _e('Request more info', 'manchester'); ?> </a> </section> <?php } else { ?> <section class="list-req"> <a href="mailto:<?php echo $api_whoami['user']['email']; ?> "><?php _e('Request more info', 'manchester'); ?> </a> </section> <?php } ?> <section class="list-btn1"> <div class="img_btn"> <a href="<?php echo $listing_data['cur_data']['url']; ?> "><input type="submit" Value="<?php _e('See Details', 'manchester'); ?> " class="button b-blue medium" /></a> </div> </section> </section><!-- /list-links --> </section><!-- /list-text --> <?php PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => $listing_data['rets']['aname'], 'office_name' => $listing_data['rets']['oname'], 'office_phone' => PLS_Format::phone($listing_data['contact']['phone']), 'agent_license' => isset($listing_data['rets']['alicense']) ? $listing_data['rets']['alicense'] : false, 'co_agent_name' => isset($listing_data['rets']['aconame']) ? $listing_data['rets']['aconame'] : false, 'co_office_name' => isset($listing_data['rets']['oconame']) ? $listing_data['rets']['oconame'] : false)); ?> </section><!-- /list-item --> <div class="separator-1-sma"></div> <?php // END FOR EACH ?> <?php $listing_html = ob_get_clean(); return $listing_html; }
public static function init($content) { global $post; if ($post->post_type == 'property') { $html = ''; $listing_data = PLS_Plugin_API::get_listing_in_loop(); // re-order images by assigned order $property_images = is_array($listing_data['images']) ? $listing_data['images'] : array(); usort($property_images, array('PLS_Partials_Property_Details', 'sort_images_by_order')); // reset the images $listing_data['images'] = $property_images; // Problems with API key or inconsistent data lead to notices due to null listings if (!is_null($listing_data)) { $listing_data['location']['full_address'] = $listing_data['location']['address'] . ' ' . $listing_data['location']['locality'] . ' ' . $listing_data['location']['region']; // This has to happen here to ensure it's not filtered out by whatever might be filtering this output... echo PLS_Plugin_API::log_snippet_js('listing_view', array('prop_id' => $listing_data['id'])); ob_start(); ?> <h2 itemprop="name" itemscope itemtype="http://schema.org/PostalAddress"> <span itemprop="streetAdress"><?php echo $listing_data['location']['address']; ?> </span> <span itemprop="addressLocality"><?php echo $listing_data['location']['locality']; ?> </span>, <span itemprop="addressRegion"><?php echo $listing_data['location']['region']; ?> </span> </h2> <?php echo PLS_Plugin_API::placester_favorite_link_toggle(array('property_id' => $listing_data['id'], 'add_text' => 'Add To Favorites', 'remove_text' => 'Remove From Favorites')); ?> <p itemprop="price"><?php echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true)); ?> <span><?php echo PLS_Format::translate_lease_terms($listing_data); ?> </span></p> <p class="listing_type"><?php if (isset($listing_data['zoning_types'][0]) && isset($listing_data['purchase_types'][0])) { echo ucwords(@$listing_data['zoning_types'][0] . ' ' . @$listing_data['purchase_types'][0]); } ?> </p> <div class="clearfix"></div> <?php if ($listing_data['images']) { ?> <div class="theme-default property-details-slideshow"> <?php echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 590, 'h' => 300), 'fancybox' => false, 'as_html' => true, 'html' => array('itemprop' => 'image'))); ?> <?php // echo PLS_Slideshow::slideshow( array( 'anim_speed' => 1000, 'pause_time' => 15000, 'control_nav' => true, 'width' => 620, 'height' => 300, 'context' => 'home', 'data' => PLS_Slideshow::prepare_single_listing($listing_data) ) ); ?> </div> <div class="details-wrapper grid_8 alpha"> <div id="slideshow" class="clearfix theme-default left bottomborder"> <div class="grid_8 alpha"> <ul class="property-image-gallery grid_8 alpha"> <?php foreach ($listing_data['images'] as $images) { ?> <li><?php echo PLS_Image::load($images['url'], array('resize' => array('w' => 100, 'h' => 75), 'fancybox' => true, 'as_html' => true, 'html' => array('itemprop' => 'image'))); ?> </li> <?php } ?> </ul> </div> </div> </div> <?php } ?> <div class="basic-details grid_8 alpha"> <ul> <li><span>Beds: </span><?php echo $listing_data['cur_data']['beds']; ?> </li> <li><span>Baths: </span><?php echo $listing_data['cur_data']['baths']; ?> </li> <?php if (isset($listing_data['cur_data']['half_baths']) && $listing_data['cur_data']['half_baths'] != null) { ?> <li><span>Half Baths: </span><?php echo $listing_data['cur_data']['half_baths']; ?> </li> <?php } ?> <li><span>Square Feet: </span><?php echo PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false)); ?> </li> <?php if (isset($listing_data['cur_data']['avail_on']) && $listing_data['cur_data']['avail_on'] != null) { ?> <li itemprop="availability"><span>Available: </span><?php echo @$listing_data['cur_data']['avail_on']; ?> </li> <?php } ?> <li>Property Type: <?php echo PLS_Format::translate_property_type($listing_data); ?> </li> <?php if (isset($listing_data['rets']) && isset($listing_data['rets']['mls_id'])) { ?> <li><span>MLS #: </span><?php echo $listing_data['rets']['mls_id']; ?> </li> <?php } ?> </ul> </div> <div class="details-wrapper grid_8 alpha"> <h3>Property Description</h3> <?php if (!empty($listing_data['cur_data']['desc'])) { ?> <p itemprop="description"><?php echo $listing_data['cur_data']['desc']; ?> </p> <?php } else { ?> <p> No description available </p> <?php } ?> </div> <?php $amenities = PLS_Format::amenities_but($listing_data, array('half_baths', 'beds', 'baths', 'url', 'sqft', 'avail_on', 'price', 'desc')); ?> <?php if (!empty($amenities['list'])) { ?> <div class="amenities-section grid_8 alpha"> <h3>Listing Amenities</h3> <ul> <?php $amenities['list'] = PLS_Format::translate_amenities($amenities['list']); ?> <?php foreach ($amenities['list'] as $amenity => $value) { ?> <li><span><?php echo $amenity; ?> </span> <?php echo $value; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php if (!empty($amenities['ngb'])) { ?> <div class="amenities-section grid_8 alpha"> <h3>Local Amenities</h3> <ul> <?php $amenities['ngb'] = PLS_Format::translate_amenities($amenities['ngb']); ?> <?php foreach ($amenities['ngb'] as $amenity => $value) { ?> <li><span><?php echo $amenity; ?> </span> <?php echo $value; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php if (!empty($amenities['uncur'])) { ?> <div class="amenities-section grid_8 alpha"> <h3>Custom Amenities</h3> <ul> <?php $amenities['uncur'] = PLS_Format::translate_amenities($amenities['uncur']); ?> <?php foreach ($amenities['uncur'] as $amenity => $value) { ?> <li><span><?php echo $amenity; ?> </span> <?php echo $value; ?> </li> <?php } ?> </ul> </div> <?php } ?> <div class="map-wrapper grid_8 alpha"> <h3>Property Map</h3> <script type="text/javascript"> jQuery(document).ready(function( $ ) { var map = new Map(); var listing = new Listings({ single_listing : <?php echo json_encode($listing_data); ?> , map: map }); map.init({ type: 'single_listing', listings: listing, lat : <?php echo json_encode($listing_data['location']['coords'][0]); ?> , lng : <?php echo json_encode($listing_data['location']['coords'][1]); ?> , zoom : 14 }); listing.init(); }); </script> <div class="map"> <?php echo PLS_Map::dynamic($listing_data, array('lat' => $listing_data['location']['coords'][0], 'lng' => $listing_data['location']['coords'][1], 'height' => 250, 'zoom' => 16)); ?> </div> </div> <?php PLS_Listing_Helper::get_compliance(array('context' => 'listings', 'agent_name' => @$listing_data['rets']['aname'], 'office_name' => @$listing_data['rets']['oname'])); ?> <?php // Store output... $html = ob_get_clean(); } // Enable Lead Capture $lead_capture_enable = pls_get_option('pd-lc-enable'); if ($lead_capture_enable == 1) { ob_start(); ?> <!-- Lead Capture Shortcode --> <div style="display:none;" href="#" id="property-details-lead-capture"> <?php do_shortcode('[lead_capture_template lead_capture_cookie="true" name_required="true" question_required="false" width="440"]'); ?> </div> <?php // Store output... $lead_capture_block = ob_get_clean(); } $html = apply_filters('property_details_filter', $html, $listing_data); // Add lead capture block to HTML if (isset($lead_capture_block)) { $html = $lead_capture_block . $html; } return $html; } // Post is not of type property, so just return what was initially passed in... return $content; }