function widget($args, $instance) { if (is_singular() && get_post_type() == 'property') { extract($args, EXTR_SKIP); $title = '[' . __('Property Title', 'wpsight') . ']'; $title_property = apply_filters('the_title', get_the_title(get_the_ID())); $title_favorites = isset($instance['title_favorites']) ? $instance['title_favorites'] : true; $title_print = isset($instance['title_print']) ? $instance['title_print'] : true; ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-title listing-title section clearfix clear"> <div class="title clearfix"> <h1 class="entry-title"><?php echo apply_filters('wpsight_widget_listing_title', $title_property, $args, $instance); ?> </h1> <?php // Action hook property title inside do_action('wpsight_listing_title_inside', $args, $instance); ?> </div> </div><!-- .property-title --><?php } }
function widget($args, $instance) { if (is_singular() && get_post_type() == wpsight_listing_post_type()) { extract($args, EXTR_SKIP); $title = apply_filters('widget_title', '[' . __('Listing Title', 'wpsight') . ']', $instance, $this->id_base); $title_listing = get_the_title(get_the_ID()); ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-title section clearfix clear"> <div class="title clearfix"> <h1 class="entry-title"><?php echo apply_filters('wpsight_widget_listing_title', $title_listing, $args, $instance); ?> </h1> <?php // Action hook listing title inside do_action('wpsight_listing_title_inside', $args, $instance); ?> </div> </div><!-- .listing-title --><?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $align = isset($instance['align']) ? $instance['align'] : 'left'; $notitle = empty($title) ? ' no-title' : ''; ?> <div id="<?php echo wpsight_dashes($widget_id); ?> -wrap" class="widget-wrap widget-divider-wrap<?php echo $notitle; ?> "> <div id="<?php echo wpsight_dashes($widget_id); ?> " class="widget widget-divider clearfix"> <div class="widget-inner"><?php if (!empty($title)) { $align = 'title-' . $align; echo '<h3 class="title ' . $align . '">' . $title . '</h3>'; } ?> </div><!-- .widget-inner --> </div><!-- .widget --> </div><!-- .widget-wrap --><?php }
function widget($args, $instance) { if (is_single() && get_post_type() == wpsight_listing_post_type()) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $unlink_features = isset($instance['unlink_features']) ? $instance['unlink_features'] : false; // Get features $listing_features_terms = get_the_terms(get_the_ID(), 'feature'); // Stop here if no features if (empty($listing_features_terms)) { return; } ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-features section clearfix clear"> <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing features title inside do_action('wpsight_listing_features_title_inside', $args, $instance); ?> </div> <?php } // Display features if (is_single() && get_post_type() == wpsight_listing_post_type() && !empty($listing_features_terms)) { $listing_features = '<ul class="clearfix">'; foreach ($listing_features_terms as $term) { // Optionally unlink features if ($unlink_features) { $listing_features .= '<li>' . $term->name . '</li>'; } else { $listing_features .= '<li><a href="' . get_term_link($term, 'feature') . '">' . $term->name . '</a></li>'; } } $listing_features .= '</ul>'; echo apply_filters('wpsight_widget_listing_features', $listing_features, $args, $instance); } ?> </div> <?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $text = isset($instance['text']) ? wp_kses_post($instance['text']) : false; $button = isset($instance['button']) ? strip_tags($instance['button']) : false; $label = isset($instance['label']) ? strip_tags($instance['label']) : __('Button Label', 'wpsight'); $target = isset($instance['target']) ? $instance['target'] : false; // Set button link if (substr($button, 0, 4) == 'http' || substr($button, 0, 1) == '#') { $url = $button; } elseif (is_numeric($button)) { $url = get_permalink($button); } // When jump link set smooth class $smooth = substr($button, 0, 1) == '#' ? ' smooth' : false; ?> <div id="<?php echo wpsight_dashes($this->id); ?> -wrap" class="widget-wrap widget-call-to-action-wrap"> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget widget-call-to-action clearfix"> <div class="widget-inner"><?php // Create call to action text $output = ''; if (!empty($title)) { $output .= '<h2>' . apply_filters('widget_title', $title, $instance, $this->id_base) . '</h2>'; } if (!empty($text)) { $output .= '<span>' . $text . '</span>'; } if (!empty($output)) { echo '<span class="call-to-action-text">' . $output . '</span>'; } // Create call to action button $target = $target ? ' target="_blank"' : ''; if (!empty($url)) { echo '<span class="call-to-action-button"><a class="' . apply_filters('wpsight_button_class_calltoaction', 'btn btn-large btn-primary') . $smooth . '" href="' . $url . '"' . $target . '>' . $label . '</a></span>'; } ?> </div><!-- .widget-inner --> </div><!-- .widget --> </div><!-- .widget-wrap --><?php }
function widget($args, $instance) { if (is_single() && get_post_type() == wpsight_listing_post_type()) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $margin = empty($title) ? ' style="margin-top:-10px"' : ''; // Get description $listing = get_post(get_the_ID()); $listing_description = apply_filters('the_content', $listing->post_content); if (empty($listing_description)) { return; } ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-description section clearfix clear"<?php echo $margin; ?> > <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing description title inside do_action('wpsight_listing_description_title_inside', $args, $instance); ?> </div> <?php } // Display content echo apply_filters('wpsight_widget_listing_description', $listing_description, $args, $instance); ?> </div> <?php } }
function widget($args, $instance) { global $authordata; extract($args, EXTR_SKIP); if (is_single() && get_post_type() == wpsight_listing_post_type()) { $title_name = isset($instance['title_name']) ? $instance['title_name'] : true; $title = $title_name ? '[' . __('Agent Name', 'wpsight') . ']' : strip_tags($instance['title']); $title_contact = isset($instance['title_contact']) ? $instance['title_contact'] : false; ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-agent section clearfix clear"> <?php // Build widget title if ($title_name) { $title = get_the_author_meta('display_name'); } // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2 class="author"><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing agent title inside do_action('wpsight_listing_agent_title_inside', $args, $instance); ?> </div><?php } // Get author/listing agent information do_action('wpsight_listing_agent', 'listing', $args, $instance); ?> </div><!-- .listing-agent --> <?php } }
function widget($args, $instance) { if (is_single() && get_post_type() == wpsight_listing_post_type()) { $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $instance['email'] = isset($instance['email']) ? sanitize_email($instance['email']) : false; ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-contact section clearfix clear"> <div id="contact"> <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing contact title inside do_action('wpsight_listing_contact_title_inside', $args, $instance); ?> </div><?php } /** * Display contact form. * See code in /lib/framework/contact.php */ do_action('wpsight_contact_form', 'listing', $instance, array('context' => 'widget', 'id' => $this->id)); ?> </div><!-- #contact --> </div> <?php } }
function widget($args, $instance) { global $authordata; extract($args, EXTR_SKIP); if (is_single() && get_post_type() == 'property') { $title_name = isset($instance['title_name']) ? $instance['title_name'] : true; $title = $title_name ? '[' . __('Agent Name', 'wpsight') . ']' : strip_tags($instance['title']); $title_contact = isset($instance['title_contact']) ? $instance['title_contact'] : false; ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-agent listing-agent section clearfix clear"> <?php // Build widget title if ($title_name) { $title = get_the_author_meta('display_name'); } // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2 class="author"><?php echo $title; ?> </h2> <?php // Action hook property agent title inside do_action('wpsight_listing_agent_title_inside', $args, $instance); ?> </div><?php } // Get author loop template get_template_part('loop', 'author'); ?> </div><!-- .property-agent --> <?php } }
function widget($args, $instance) { if (is_single() && get_post_type() == 'property' && has_post_thumbnail(get_the_ID())) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-image listing-image section clearfix clear"> <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo $title; ?> </h2> <?php // Action hook property description title inside do_action('wpsight_listing_image_title_inside', $args, $instance); ?> </div> <?php } // If in sidebar display smaller image $args['id'] = isset($args['id']) ? $args['id'] : false; $wpcasa_thumb = $args['id'] == 'sidebar-property' ? 'post-thumbnail' : 'big'; // Set full width image if (get_post_meta(get_the_ID(), '_layout', true) == 'full-width') { $wpcasa_thumb = 'full'; } // Display featured image echo apply_filters('wpsight_widget_listing_image', get_the_post_thumbnail(get_the_ID(), $wpcasa_thumb, array('alt' => get_the_title(), 'title' => get_the_title())), $args, $instance); ?> </div><!-- .property-image --><?php } }
function widget($args, $instance) { if (is_single() && get_post_type() == 'property') { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $email_widget = isset($instance['email']) ? sanitize_email($instance['email']) : false; ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-contact listing-contact section clearfix clear"> <div id="contact"><?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo $title; ?> </h2> <?php // Action hook property contact title inside do_action('wpsight_listing_contact_title_inside', $args, $instance); ?> </div><?php } /** * Display contact form. * See code in /lib/framework/properties.php */ do_action('wpsight_contact_form', 'listing', $instance); ?> </div> </div> <?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="listing-search-widget section clearfix clear"> <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h1><?php echo $title; ?> </h1> <?php // Action hook property description title inside do_action('wpsight_listing_search_title_inside', $args, $instance); ?> </div> <?php } /** * Display search form. * See code in /lib/framework/properties.php */ do_action('wpsight_listings_search', $args, $instance); ?> </div> <?php }
function widget($args, $instance) { extract($args, EXTR_SKIP); // Only on posts and pages if (!is_singular()) { return; } $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $space = isset($instance['space']) ? $instance['space'] : false; // Get custom field $space_content = get_post_meta(get_the_ID(), $space, true); // Stop if it has no value if (empty($space_content)) { return; } ?> <div id="<?php echo wpsight_dashes($this->id); ?> -wrap" class="widget-wrap widget-post-spaces-wrap"> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget section widget-post-spaces clearfix"> <div class="widget-inner"><?php if (!empty($title)) { echo '<h3 class="title">' . apply_filters('widget_title', $title, $instance, $this->id_base) . '</h3>'; } echo wpsight_format_content($space_content); ?> </div><!-- .widget-inner --> </div><!-- .widget --> </div><!-- widget-wrap --><?php }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listings-search-widget section clearfix clear"><?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing search title inside do_action('wpsight_listings_search_title_inside', $args, $instance); ?> </div> <?php } /** * Display search form. * See code in /lib/framework/listings.php */ do_action('wpsight_listings_search', $args, $instance); ?> </div><?php }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? apply_filters('widget_title', strip_tags($instance['title']), $instance, $this->id_base) : false; $filter = isset($instance['filter']) ? strip_tags($instance['filter']) : false; $effect = isset($instance['effect']) ? $instance['effect'] : 'fade'; $direction = isset($instance['direction']) ? $instance['direction'] : 'horizontal'; $timer = isset($instance['timer']) ? (int) $instance['timer'] : 0; $prevnext = isset($instance['prevnext']) ? $instance['prevnext'] : true; $overlay = isset($instance['overlay']) ? $instance['overlay'] : true; $details = isset($instance['details']) ? $instance['details'] : true; $teaser = isset($instance['teaser']) ? $instance['teaser'] : true; $keynav = isset($instance['keynav']) ? $instance['keynav'] : true; $mousenav = isset($instance['mousenav']) ? $instance['mousenav'] : false; $random = isset($instance['random']) ? $instance['random'] : false; $unlink = isset($instance['unlink']) ? $instance['unlink'] : false; $number = isset($instance['number']) ? (int) $instance['number'] : 10; $length = isset($instance['length']) ? (int) $instance['length'] : 15; /** * Only show slider on first page * if blog template on front page */ global $page; if (isset($page) && $page != 1) { return; } // Create query args if ($filter != 'custom') { $query_args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => $number); // Add filter to query args if required if (!empty($filter)) { if ($filter == 'latest-sale') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'sale')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } elseif ($filter == 'latest-rent') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'rent')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } elseif ($filter == 'latest-new') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'new')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } elseif ($filter == 'latest-used') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'used')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } else { // Get taxonomy and term from filter (comma-separated value) $get_taxonomy = explode(',', $filter); $taxonomy = $get_taxonomy[0]; $term = $get_taxonomy[1]; // Set tax_query $tax_query = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => array($term))); $query_args = array_merge($query_args, array('tax_query' => $tax_query)); } } } else { // If filter is custom, create meta query (slider => 1) $query_args = array('post_type' => array(wpsight_listing_post_type()), 'posts_per_page' => $number, 'meta_query' => array(array('key' => 'slider', 'value' => '1'))); } // Add random order to query args if required if ($random == true) { $query_args = array_merge($query_args, array('orderby' => 'random')); } $query_args = apply_filters('wpsight_widget_slider_query_args', $query_args, $args, $instance); // Check if transients are active $transients = apply_filters('wpsight_transients_queries', false, 'widget', $query_args, $this->id); // If query transients are active if ($transients === true) { // If transient does not exist if (false === ($slider = get_transient('wpsight_query_' . $this->id))) { // Create listing query $slider = new WP_Query($query_args); // Set transient for this query set_transient('wpsight_query_' . $this->id, $slider, DAY_IN_SECONDS); } // If query transients are not active } else { // Create listing query $slider = new WP_Query($query_args); } if ($slider->have_posts()) { // Create loop counter $counter = 1; // Set image size depending on widget area if ($id == 'home') { $image_size = 'big'; } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-archive' || $id == 'sidebar-page' || $id == 'sidebar-post' || $id == wpsight_get_sidebar('sidebar-listing') || $id == wpsight_get_sidebar('sidebar-listing-archive')) { $image_size = 'post-thumbnail'; } else { $image_size = 'full'; } $image_size = apply_filters('wpsight_widget_listings_slider_image_size', $image_size, $args, $instance); // Create widget output ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget widget-slider widget-listings-slider clearfix"> <div class="widget-inner"> <?php // Display widget title if (!empty($title)) { ?> <div class="title title-widget clearfix"> <?php echo apply_filters('wpsight_widget_listings_slider_title', '<h2>' . $title . '</h2>', $args, $instance); do_action('wpsight_widget_listings_slider_title_actions', $args, $instance); ?> </div><?php } // endif $title // Convert boolean to strings for Javascript options $prevnext = $prevnext == true ? 'true' : 'false'; $keynav = $keynav == true ? 'true' : 'false'; $mousenav = $mousenav == true ? 'true' : 'false'; $random = $random == true ? 'true' : 'false'; // Correct timer and slideshow = true $slideshow = $timer == 0 ? 'false' : 'true'; $slider_args = array('animation' => '"' . $effect . '",', 'direction' => '"' . $direction . '",', 'slideshow' => "{$slideshow},", 'slideshowSpeed' => "{$timer},", 'animationDuration' => '300,', 'directionNav' => "{$prevnext},", 'controlNav' => 'false,', 'keyboardNav' => "{$keynav},", 'mousewheel' => "{$mousenav},", 'prevText' => '"' . __('Previous', 'wpsight') . '",', 'nextText' => '"' . __('Next', 'wpsight') . '",', 'pausePlay' => 'false,', 'pauseText' => '"' . __('Pause', 'wpsight') . '",', 'playText' => '"' . __('Play', 'wpsight') . '",', 'randomize' => "{$random},", 'animationLoop' => 'true,', 'pauseOnAction' => 'true,', 'pauseOnHover' => 'true'); $slider_args = apply_filters('wpsight_widget_listings_slider_options_args', $slider_args, $args, $instance); ?> <script type="text/javascript"> jQuery(document).ready(function($){ $(function(){ $('.flexslider').flexslider({ <?php foreach ($slider_args as $k => $v) { echo $k . ': ' . $v . "\n"; } ?> }); }); }); </script> <?php /** * Set fixed height on slider container * to avoid layout jump on load */ $img = wpsight_get_image_size($image_size); $height = $img['size']['h']; ?> <div class="flexslider height-<?php echo $height; ?> "> <ul class="slides"> <?php // Loop through posts while ($slider->have_posts()) { $slider->the_post(); // Check if slider_embed is active $slider_embed = get_post_meta(get_the_ID(), 'slider_embed', true); if (!empty($slider_embed)) { echo '<li>' . wp_kses_post($slider_embed) . '</li>'; } elseif (has_post_thumbnail()) { ?> <li> <?php if ($unlink == false) { echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), $image_size, array('alt' => get_the_title(), 'title' => get_the_title())) . '</a>'; } else { echo get_the_post_thumbnail(get_the_ID(), $image_size, array('alt' => get_the_title(), 'title' => get_the_title())); } if ($overlay == true) { ?> <div class="overlay<?php if ($teaser == false) { echo ' no-teaser'; } ?> "> <?php // Action hook to add content before overlay title do_action('wpsight_widget_listings_slider_title_before', $args, $instance); ?> <h3> <?php if ($unlink == false) { echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>'; } else { echo get_the_title(); } ?> </h3> <?php // Action hook to add content after overlay title do_action('wpsight_widget_listings_slider_title_after', $args, $instance); if ($teaser == true) { if ($unlink == false) { wpsight_the_excerpt(get_the_ID(), true, $length); } else { echo wpsight_format_content(get_the_content(false)); } // Action hook to add content after overlay teaser do_action('wpsight_widget_listings_slider_teaser_after', $args, $instance); } ?> </div> <?php } ?> </li> <?php } // endif has_post_thumbnail() } // endwhile have_posts() ?> </ul> </div><!-- .flexslider --> </div><!-- .widget-inner --> </div><!-- .widget-slider --><?php } // endif have_posts() }
function widget($args, $instance) { if (is_listing_single() && has_post_thumbnail(get_the_ID())) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; // Set image info $thumbnail = get_post(get_post_thumbnail_id()); $thumbnail_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); // Get image caption $caption = $thumbnail->post_excerpt ? $thumbnail->post_excerpt : false; // Get image alt text $alt = $thumbnail_alt ? $thumbnail_alt : get_the_title(); // Get image description $description = $thumbnail->post_content ? $thumbnail->post_content : get_the_title(); ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-image section clearfix clear"> <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing description title inside do_action('wpsight_listing_image_title_inside', $args, $instance); ?> </div> <?php } // If in sidebar display smaller image $args['id'] = isset($args['id']) ? $args['id'] : false; $wpsight_thumb = $args['id'] == wpsight_get_sidebar('sidebar-listing') ? 'post-thumbnail' : 'big'; // Set full width image if (get_post_meta(get_the_ID(), '_layout', true) == 'full-width') { $wpsight_thumb = 'full'; } // Set full width image if (!is_active_sidebar(wpsight_get_sidebar('sidebar-listing'))) { $wpsight_thumb = 'full'; } // Display featured image $listing_image = apply_filters('wpsight_widget_listing_image', get_the_post_thumbnail(get_the_ID(), $wpsight_thumb, array('alt' => $alt, 'title' => $description)), $args, $instance); // Wrap if caption if ($caption) { $listing_image = '<div class="wp-caption alignnone">' . $listing_image . '<p class="wp-caption-text">' . $caption . '</p>' . '</div><!-- .wp-caption -->'; } echo $listing_image; ?> </div><!-- .listing-image --><?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $filter = isset($instance['filter']) ? strip_tags($instance['filter']) : false; if (!($number = (int) $instance['number'])) { $number = 1; } else { if ($number < 1) { $number = 1; } else { if ($number > 20) { $number = 20; } } } if (!($length = (int) $instance['length'])) { $length = 25; } else { if ($length < 1) { $length = 25; } } $width = isset($instance['width']) ? $instance['width'] : 'full'; // Correct width if ($width == wpsight_get_span('big') && ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter')) { $width = wpsight_get_span('full'); } if (($width == wpsight_get_span('full') || $width == wpsight_get_span('half')) && $id == 'home') { $width = wpsight_get_span('big'); } // Check widget width if ($width != 'full') { $widget_width = $width; } else { $widget_width = ''; if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { $clear = ' clearfix'; } } if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'home' && ($width == 'span12' || $width == 'full')) { $widget_width = ''; $clear = ' clearfix'; } // Create query args $query_args = array('post_type' => array('property'), 'posts_per_page' => $number); // Add filter to query args if required if (!empty($filter)) { if ($filter == 'latest-sale') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'sale')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } elseif ($filter == 'latest-rent') { // Set meta_query $meta_query = array(array('key' => '_price_status', 'value' => 'rent')); $query_args = array_merge($query_args, array('meta_query' => $meta_query)); } else { // Get taxonomy and term from filter (comma-separated value) $get_taxonomy = explode(',', $filter); $taxonomy = $get_taxonomy[0]; $term = $get_taxonomy[1]; // Set tax_query $tax_query = array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => array($term))); $query_args = array_merge($query_args, array('tax_query' => $tax_query)); } } $query_args = apply_filters('wpsight_widget_listings_latest_query_args', $query_args); $latest = new WP_Query($query_args); if ($latest->have_posts()) { // Create loop counter $counter = 1; ?> <div id="<?php echo wpsight_dashes($widget_id); ?> -wrap" class="widget-wrap widget-latest-wrap"> <div id="<?php echo wpsight_dashes($widget_id); ?> " class="widget widget-latest row"> <?php // Display widget title if (!empty($title)) { ?> <div class="title title-widget clearfix"> <?php echo apply_filters('wpsight_widget_listings_latest_title', '<h2>' . $title . '</h2>'); do_action('wpsight_widget_listings_latest_title_actions'); ?> </div> <?php } // endif $title // Begin to loop through posts while ($latest->have_posts()) { // Set up post data $latest->the_post(); $clear = ''; // Add .clear to post class with if madness if (WPSIGHT_LAYOUT == 'four') { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 4 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-property' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-property-archive') { $widget_width = 'span3'; $clear = ' clear'; } } else { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span4') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span4') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-property' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-property-archive') { $widget_width = 'span4'; $clear = ' clear'; } } ?> <div <?php post_class($widget_width . $clear . ' clearfix'); ?> > <div class="widget-inner"> <?php // Action hook before property title (widget) do_action('wpsight_widget_listing_title_before', $width, $id); ?> <h3 class="post-title"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"> <?php // Action hook post title inside do_action('wpsight_widget_listing_title_inside'); the_title(); ?> </a> </h3> <?php // Action hook after property title (widget) do_action('wpsight_widget_listing_title_after', $width, $id); // Action hook before property content (widget) do_action('wpsight_widget_listing_content_before', $width, $id); ?> <div class="post-teaser"> <?php wpsight_the_excerpt(get_the_ID(), false, $length); ?> </div> <?php // Action hook after property content (widget) do_action('wpsight_widget_listing_content_after', $width, $id); ?> </div><!-- .widget-inner --> </div><!-- .post-<?php the_ID(); ?> --><?php // Increase loop counter $counter++; } // endwhile have_posts() ?> </div><!-- .widget --> </div><!-- .widget-wrap --><?php } // endif have_posts() }
function widget($args, $instance) { if (is_single() && get_post_type() == 'property') { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $display = isset($instance['display']) ? $instance['display'] : 'thumbs'; $effect = isset($instance['slider_effect']) ? $instance['slider_effect'] : 'fade'; $timer = isset($instance['slider_timer']) ? (int) $instance['slider_timer'] : 0; $prevnext = isset($instance['slider_prevnext']) ? $instance['slider_prevnext'] : true; $links = isset($instance['gallery_links']) ? $instance['gallery_links'] : false; $exclude_featured = isset($instance['exclude_featured']) ? $instance['exclude_featured'] : false; // Only allow comma-separated list $exclude_images = isset($instance['exclude_images']) ? preg_replace(array('/[^\\d,]/', '/(?<=,),+/', '/^,+/', '/,+$/'), '', $instance['exclude_images']) : false; // Optional include $exclude_images = get_post_meta(get_the_ID(), 'property_include', true); $include = preg_replace(array('/[^\\d,]/', '/(?<=,),+/', '/^,+/', '/,+$/'), '', $exclude_images); // Create exclude $exclude = false; if ($exclude_featured) { $exclude = 'featured'; } if ($exclude_images) { $exclude = $exclude_images; } // Create prevnext $prevnext = $prevnext ? 'true' : 'false'; // Remove links $links = $links ? 'false' : 'true'; $do_shortcode_args = array('exclude' => $exclude, 'include' => $include, 'effect' => $effect, 'timer' => $timer, 'prevnext' => $prevnext, 'link' => $links); // Correct size depending on widget area if ($args['id'] == 'sidebar-property' || $args['id'] == 'sidebar') { $do_shortcode_args = array_merge(array('size' => 'small'), $do_shortcode_args); } $do_shortcode_args = apply_filters('wpsight_property_gallery_shortcode_args', $do_shortcode_args, $args, $instance); // Set up $shortcode_args for shortcode $shortcode_args = ''; foreach ($do_shortcode_args as $k => $v) { if ($do_shortcode_args[$k]) { $shortcode_args .= ' ' . $k . '="' . $v . '"'; } } // Reduce margin top if title empty $margin = empty($title) ? ' style="margin-top:-10px"' : ''; // Create property gallery $remove_links = isset($remove_links) ? $remove_links : false; $property_gallery = ''; if ($display == 'thumbs') { // Apply image_gallery shortcode $property_gallery .= do_shortcode('[image_gallery' . $shortcode_args . $remove_links . ']'); } else { // Apply image_slider shortcode $property_gallery .= do_shortcode('[image_slider' . $shortcode_args . $remove_links . ']'); } // Stop if no images if (empty($property_gallery)) { return; } ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-gallery listing-gallery section clearfix clear"<?php echo $margin; ?> > <?php // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo $title; ?> </h2> <?php // Action hook property gallery title inside do_action('wpsight_listing_gallery_title_inside', $args, $instance); ?> </div> <?php } echo apply_filters('wpsight_widget_listing_gallery', $property_gallery, $args, $instance); ?> </div><!-- .property-gallery --><?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $maptype = isset($instance['map_type']) ? $instance['map_type'] : 'ROADMAP'; $mapzoom = isset($instance['map_zoom']) ? (int) $instance['map_zoom'] : 14; $streetview = isset($instance['streetview']) ? $instance['streetview'] : true; $map_args = array('control_type' => 'false', 'control_nav' => 'true', 'scrollwheel' => 'false', 'map_icon' => apply_filters('wpsight_map_listing_icon', WPSIGHT_ASSETS_IMG_URL . '/map-listing.png'), 'map_icon_w' => 24, 'map_icon_h' => 37, 'map_icon_x' => 12, 'map_icon_y' => 37, 'map_icon_shadow' => apply_filters('wpsight_map_listing_icon_shadow', WPSIGHT_ASSETS_IMG_URL . '/map-listing-shadow.png'), 'map_icon_shadow_w' => 24, 'map_icon_shadow_h' => 17, 'map_icon_shadow_x' => 12, 'map_icon_shadow_y' => 8); $map_args = apply_filters('wpsight_widget_listing_location_map_args', $map_args, $args, $instance); if (is_single() && get_post_type() == wpsight_listing_post_type()) { // Get post custom data $custom = get_post_custom(get_the_ID()); if (!isset($custom['_map_hide'][0]) || empty($custom['_map_hide'][0])) { // Get geo code if (!empty($custom['_map_geo'][0])) { $marker = 'latLng:[' . $custom['_map_geo'][0] . ']'; } // Get address if (!empty($custom['_map_address'][0])) { $marker = 'address: "' . $custom['_map_address'][0] . '"'; } // If new location value is available, use it if (!empty($custom['_map_location'][0])) { $marker = 'latLng:[' . $custom['_map_location'][0] . ']'; } if (!empty($marker)) { ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-location section clearfix clear"> <?php $marker = 'marker:{ ' . $marker . ', options: { icon: ' . apply_filters('wpsight_map_listing_marker_icon', 'new google.maps.MarkerImage("' . $map_args['map_icon'] . '", new google.maps.Size(' . $map_args['map_icon_w'] . ', ' . $map_args['map_icon_h'] . '), new google.maps.Point(0, 0), new google.maps.Point(' . $map_args['map_icon_x'] . ', ' . $map_args['map_icon_y'] . '))', get_the_ID(), $map_args) . ', shadow: ' . apply_filters('wpsight_map_listing_marker_icon_shadow', 'new google.maps.MarkerImage("' . $map_args['map_icon_shadow'] . '", new google.maps.Size(' . $map_args['map_icon_shadow_w'] . ', ' . $map_args['map_icon_shadow_h'] . '), new google.maps.Point(0, 0), new google.maps.Point(' . $map_args['map_icon_shadow_x'] . ', ' . $map_args['map_icon_shadow_y'] . '))', get_the_ID(), $map_args) . ' } }'; $listing_location = '<script type="text/javascript"> jQuery(document).ready(function($){ $(".listing-location-map").gmap3({ ' . $marker . ', map:{ options:{ zoom: ' . $mapzoom . ', mapTypeId: google.maps.MapTypeId.' . $maptype . ', mapTypeControl: ' . $map_args['control_type'] . ', navigationControl: ' . $map_args['control_nav'] . ', scrollwheel: ' . $map_args['scrollwheel'] . ', streetViewControl: ' . $streetview . ' } } }); }); </script>'; // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo apply_filters('widget_title', $title, $instance, $this->id_base); ?> </h2> <?php // Action hook listing location title inside do_action('wpsight_listing_location_title_inside', $args, $instance); ?> </div> <?php } $listing_location .= '<div class="listing-location-map"></div>'; if (!empty($custom['_map_note'][0])) { $listing_location .= '<div class="listing-location-map-note alert clear">' . $custom['_map_note'][0] . '</div>'; } echo apply_filters('wpsight_widget_listing_location', $listing_location, $args, $instance); ?> </div><!-- .listing-location --><?php } // endif ! empty( $marker ) } } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $maptype = isset($instance['map_type']) ? $instance['map_type'] : 'ROADMAP'; $mapzoom = isset($instance['map_zoom']) ? (int) $instance['map_zoom'] : 14; $streetview = isset($instance['streetview']) ? $instance['streetview'] : true; $map_args = array('control_type' => 'false', 'control_nav' => 'true', 'scrollwheel' => 'false'); $map_args = apply_filters('wpsight_widget_listing_location_map_args', $map_args, $args, $instance); if (is_single() && get_post_type() == 'property') { // Get post custom data $custom = get_post_custom(get_the_ID()); // Get marker address or geo code if (!empty($custom['_map_geo'][0])) { $marker = 'latLng:[' . $custom['_map_geo'][0] . ']'; } elseif (!empty($custom['_map_address'][0])) { $marker = 'address: "' . $custom['_map_address'][0] . '"'; } if (!empty($marker)) { ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="property-location listing-location section clearfix clear"> <?php $property_location = '<script type="text/javascript"> jQuery(document).ready(function($){ $(".property-location-map").gmap3({ marker:{ ' . $marker . ' }, map:{ options:{ zoom: ' . $mapzoom . ', mapTypeId: google.maps.MapTypeId.' . $maptype . ', mapTypeControl: ' . $map_args['control_type'] . ', navigationControl: ' . $map_args['control_nav'] . ', scrollwheel: ' . $map_args['scrollwheel'] . ', streetViewControl: ' . $streetview . ' } } }); }); </script>'; // Display title if exists if (!empty($title)) { ?> <div class="title clearfix"> <h2><?php echo $title; ?> </h2> <?php // Action hook property location title inside do_action('wpsight_listing_location_title_inside', $args, $instance); ?> </div> <?php } $property_location .= '<div class="property-location-map"></div>'; echo apply_filters('wpsight_widget_listing_location', $property_location, $args, $instance); ?> </div><!-- .property-location --> <?php } // endif ! empty( $marker ) } }
/** * Backwards compatiblity for * wpcasa_dashes() * * @since 1.2 */ function wpcasa_dashes($id) { wpsight_dashes($id); }
function widget($args, $instance) { extract($args, EXTR_SKIP); $property_type = isset($instance['property_type']) ? $instance['property_type'] : true; $property_location = isset($instance['property_location']) ? $instance['property_location'] : true; $property_id = isset($instance['property_id']) ? $instance['property_id'] : true; /** Loop through standard details */ foreach (wpsight_standard_details() as $key => $values) { $key = isset($instance[$key]) ? $instance[$key] : true; } if (is_single() && get_post_type() == 'property') { ?> <div id="<?php echo wpsight_dashes($args['widget_id']); ?> " class="listing-details listing-details section clearfix clear"> <div class="title clearfix"> <div class="title-price property-price listing-price"> <?php wpsight_price(); ?> </div> <?php // Action hook property details title inside do_action('wpsight_listing_details_title_inside', $args, $instance); ?> </div><!-- .title --> <?php // Display details $standard_details = wpsight_standard_details(); $property_details = ''; // Loop through standard details if (!empty($standard_details)) { $i = 0; $property_details .= '<div class="row">' . "\n"; foreach ($standard_details as $feature => $value) { // Append property ID to details if ($i == 0 && $property_id) { $property_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details_id .= '<span class="listing-details-label">' . __('Property ID', 'wpsight') . ':</span>' . "\n"; $property_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n"; $property_details_id .= '</div><!-- .listing-details-id -->' . "\n"; $property_details .= apply_filters('wpsight_listing_details_id', $property_details_id); } $property_details_value = get_post_meta(get_the_ID(), '_' . $feature, true); if (!empty($property_details_value) && $instance[$feature]) { $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n"; $property_details .= '<span class="listing-details-value">' . $property_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n"; $property_details .= '</div><!-- .property-' . $feature . ' -->' . "\n"; } $i++; } // endforeach // Add date - will be hidden by CSS display:none $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $property_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n"; $property_details .= '</div>' . "\n"; $property_details .= '</div><!-- .row -->' . "\n"; } // endif echo apply_filters('wpsight_widget_listing_details', $property_details); ?> </div><!-- .listing-details --><?php } }
/** * Make sure all widget settings are translated */ public function wpsight_wpml_widget_settings($widget, $widget_class, $args) { foreach ($widget as $k => $v) { if ($k != 'title' && $k != 'text' && $k != 'label' && $k != 'button') { continue; } if (isset($widget[$k])) { $widget[$k] = icl_translate(WPSIGHT_NAME . ' - ' . __('Widgets', 'wpsight-wpml'), wpsight_dashes($args['widget_id']) . '_' . $k, $widget[$k]); } } return $widget; }
function widget($args, $instance) { extract($args, EXTR_SKIP); $listing_type = isset($instance['listing_type']) ? $instance['listing_type'] : true; $listing_location = isset($instance['listing_location']) ? $instance['listing_location'] : true; $listing_id = isset($instance['listing_id']) ? $instance['listing_id'] : true; // Loop through standard details foreach (wpsight_standard_details() as $key => $values) { $key = isset($instance[$key]) ? $instance[$key] : true; } if (is_single() && get_post_type() == wpsight_listing_post_type()) { ?> <div id="<?php echo wpsight_dashes($this->id); ?> " class="listing-details section clearfix clear"> <div class="title clearfix"> <div class="title-price listing-price"> <?php wpsight_price(); ?> </div> <?php // Action hook listing details title inside do_action('wpsight_listing_details_title_inside', $args, $instance); ?> </div><!-- .title --> <?php // Display details $standard_details = wpsight_standard_details(); $listing_details = ''; // Loop through standard details if (!empty($standard_details)) { $i = 0; $listing_details .= '<div class="row">' . "\n"; foreach ($standard_details as $feature => $value) { $standard_details_option = wpsight_get_option($feature); // If details hasn't been set before, display default if (!isset($standard_details_option['label'])) { $standard_details_option = wpsight_get_option($feature, true); } // Don't show detail if label is emtpy in options if (empty($standard_details_option['label'])) { continue; } // Append listing ID to details if ($i == 0 && $listing_id) { $listing_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n"; $listing_details_id .= '<span class="listing-details-label">' . __('Listing ID', 'wpsight') . ':</span>' . "\n"; $listing_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n"; $listing_details_id .= '</div><!-- .listing-details-id -->' . "\n"; $listing_details .= apply_filters('wpsight_listing_details_id', $listing_details_id, $args, $instance); } $listing_details_value = get_post_meta(get_the_ID(), '_' . $feature, true); // Check if value is data key if (!empty($value['data'])) { $listing_details_value = $value['data'][$listing_details_value]; } $listing_details_meta = get_post_meta(get_the_ID(), '_' . $feature, true); if (!empty($listing_details_meta) && $instance[$feature]) { $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $listing_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n"; $listing_details .= '<span class="listing-details-value">' . $listing_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n"; $listing_details .= '</div><!-- .listing-' . $feature . ' -->' . "\n"; } $i++; } // endforeach // Add date - will be hidden by CSS display:none $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n"; $listing_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n"; $listing_details .= '</div>' . "\n"; $listing_details .= '</div><!-- .row -->' . "\n"; } // endif echo apply_filters('wpsight_widget_listing_details', $listing_details, $args, $instance); ?> </div><!-- .listing-details --><?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); $icon = isset($instance['icon']) ? strip_tags($instance['icon']) : false; $title = isset($instance['title']) ? strip_tags($instance['title']) : false; $title_icon = isset($instance['title_icon']) ? strip_tags($instance['title_icon']) : false; $image = isset($instance['image']) ? $instance['image'] : false; $imageurl = isset($instance['imageurl']) ? $instance['imageurl'] : false; $size = isset($instance['size']) ? $instance['size'] : 'post-thumbnail'; $imagewidth = isset($instance['imagewidth']) ? $instance['imagewidth'] : false; $height = isset($instance['height']) ? $instance['height'] : false; $align = isset($instance['align']) ? $instance['align'] : 'none'; $link = isset($instance['link']) ? $instance['link'] : false; $text = isset($instance['text']) ? wp_kses_post($instance['text']) : false; $center = isset($instance['center']) ? $instance['center'] : false; $link_space = isset($instance['link_space']) ? strip_tags($instance['link_space']) : false; $width = isset($instance['width']) ? $instance['width'] : 'full'; $position = isset($instance['position']) ? $instance['position'] : false; // Check widget width $widget_width = $width; // Correct box width if necessary if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == 'sidebar-listing') { $widget_width = ''; } if ($id == 'home' && ($width == wpsight_get_span('full') || $width == wpsight_get_span('half'))) { $widget_width = wpsight_get_span('big'); } // Add class to center widget content $center = $center == true ? ' widget-spaces-center' : false; // Add width and position classes $position = $position == true ? ' first' : false; if (!empty($position)) { $widget_width = $widget_width . $position; } ?> <div id="<?php echo wpsight_dashes($this->id); ?> -wrap" class="widget-wrap widget-spaces-wrap <?php echo $widget_width; ?> "> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget widget-spaces<?php echo $center; ?> clearfix"> <div class="widget-inner"> <?php $space = ''; if ($size != 'custom') { // Correct image sizes if necessary if ($width == wpsight_get_span('small') && !empty($size) && $size != 'post-thumbnail') { $size = 'post-thumbnail'; } if ($width == wpsight_get_span('half') && !empty($size) && $size != 'post-thumbnail' && $size != 'half') { $size = 'half'; } if ($width == wpsight_get_span('big') && $size == 'full') { $size = 'big'; } // Correct image aligns if necessary if ($width == wpsight_get_span('small') || $id == 'sidebar' || $id == 'sidebar-home' || $width == wpsight_get_span('half') && $size == 'half' || $width == wpsight_get_span('big') && $size == 'big' || $size == 'full') { $align = 'none'; } } // Correct image size if empty if ($size == 'custom' && (empty($width) || empty($height))) { $size = 'post-thumbnail'; } // Check if space should be linked if ($link_space) { $url = substr($link_space, 0, 4) == 'http' ? strip_tags($link_space) : get_permalink((int) $link_space); } // Display space icon if (!empty($icon)) { $icon = '<i class="' . $icon . '"></i>'; if (!empty($url)) { $icon = '<a href="' . $url . '">' . $icon . '</a>'; } $space .= '<div class="space-icon">' . $icon . '</div>' . "\n"; } // Display title if (!empty($title)) { if (!empty($title_icon)) { $title = '<i class="' . $title_icon . '"></i>' . $title; } if (!empty($url)) { $title = '<a href="' . $url . '">' . $title . '</a>'; } $space .= '<h3 class="title">' . apply_filters('widget_title', $title, $instance, $this->id_base) . '</h3>' . "\n"; } // Display image if ($image) { // Create optional image overlay $overlay = apply_filters('wpsight_space_image_overlay', false, $args, $instance); if ($size == 'custom') { $image_tag = '<img src="' . $imageurl . '" alt="' . strip_tags($instance['title']) . '" class="attachment-' . $size . ' spaces-post-image align' . $align . '" style="max-width:' . $imagewidth . 'px!important;height:auto" />'; } else { $image_tag = wp_get_attachment_image($image, $size, false, array('class' => 'attachment-' . $size . ' spaces-post-image align' . $align)); } if ($link) { $full_size = wp_get_attachment_image_src($image, 'full'); $image_tag = '<a href="' . $full_size[0] . '" rel="prettyPhoto[gallery]" title="' . strip_tags($instance['title']) . '" class="space-image-zoom">' . $image_tag . $overlay . '</a>'; } elseif (!empty($url)) { $image_tag = '<a href="' . $url . '">' . $image_tag . $overlay . '</a>'; } $space .= '<div class="space-image">' . $image_tag . '</div>'; } // Display text if (!empty($text)) { $space .= '<div class="spaces-text">' . wpsight_format_content($text) . '</div>'; } echo apply_filters('wpsight_widget_spaces', $space, $args, $instance); ?> </div><!-- .widget-inner --> </div><!-- .widget-spaces --> </div><!-- .widget-wrap --> <?php }
function widget($args, $instance) { extract($args, EXTR_SKIP); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); $cat = $instance['cat']; if (!($number = (int) $instance['number'])) { $number = 1; } else { if ($number < 1) { $number = 1; } else { if ($number > 20) { $number = 20; } } } if (!($length = (int) $instance['length'])) { $length = 25; } else { if ($length < 1) { $length = 25; } } $width = isset($instance['width']) ? $instance['width'] : 'full'; // Correct width if ($width == wpsight_get_span('big') && ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter')) { $width = wpsight_get_span('full'); } if (($width == wpsight_get_span('full') || $width == wpsight_get_span('half')) && $id == 'home') { $width = wpsight_get_span('big'); } // Check widget width if ($width != 'full') { $widget_width = $width; } else { $widget_width = ''; if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { $clear = ' clearfix'; } } if ($id == 'sidebar' || $id == 'sidebar-home' || $id == 'home' && ($width == 'span12' || $width == 'full')) { $widget_width = ''; $clear = ' clearfix'; } // Create query args $query_args = array('post_type' => array('post'), 'cat' => $cat, 'posts_per_page' => $number, 'post_status' => 'publish', 'ignore_sticky_posts' => 1); $query_args = apply_filters('wpsight_widget_latest_query_args', $query_args, $args, $instance); // Check if transients are active $transients = apply_filters('wpsight_transients_queries', false, 'widget', $query_args, $this->id); // If query transients are active if ($transients === true) { // If transient does not exist if (false === ($latest = get_transient('wpsight_query_' . $this->id))) { // Create listing query $latest = new WP_Query($query_args); // Set transient for this query set_transient('wpsight_query_' . $this->id, $latest, DAY_IN_SECONDS); } // If query transients are not active } else { // Create listing query $latest = new WP_Query($query_args); } if ($latest->have_posts()) { // Create loop counter $counter = 1; ?> <div id="<?php echo wpsight_dashes($this->id); ?> -wrap" class="widget-wrap widget-latest-wrap"> <div id="<?php echo wpsight_dashes($this->id); ?> " class="widget widget-latest row"> <?php // Display widget title if (!empty($title)) { ?> <div class="title title-widget clearfix"> <?php echo apply_filters('wpsight_widget_latest_title', '<h2>' . $title . '</h2>', $args, $instance); do_action('wpsight_widget_latest_title_actions', $args, $instance); ?> </div> <?php } // endif $title // Begin to loop through posts while ($latest->have_posts()) { // Set up post data $latest->the_post(); $clear = ''; // Add .clear to post class with if madness if (WPSIGHT_LAYOUT == 'four') { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 4 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span3') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == wpsight_get_sidebar('sidebar-listing') || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == wpsight_get_sidebar('sidebar-listing-archive')) { $widget_width = 'span3'; $clear = ' clear'; } } else { if ($id == 'home-top' || $id == 'home-bottom' || $id == 'ffooter') { if ($width == 'span4') { if ($counter == 1 || ($counter - 1) % 3 == 0) { $clear = ' clear'; } else { $clear = ''; } } elseif ($width == 'span6') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'home') { if ($width == 'span4') { if ($counter == 1 || $counter % 2 != 0) { $clear = ' clear'; } else { $clear = ''; } } } elseif ($id == 'sidebar' || $id == 'sidebar-home' || $id == wpsight_get_sidebar('sidebar-listing') || $id == 'sidebar-post' || $id == 'sidebar-page' || $id == wpsight_get_sidebar('sidebar-listing-archive')) { $widget_width = 'span4'; $clear = ' clear'; } } ?> <div <?php post_class($widget_width . $clear . ' clearfix'); ?> > <div class="widget-inner"> <?php // Action hook before post title (widget) do_action('wpsight_widget_post_title_before', $width, $id); ?> <h3 class="post-title"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> " rel="bookmark"> <?php // Action hook post title inside do_action('wpsight_widget_post_title_inside', $width, $id); the_title(); ?> </a> </h3> <?php // Action hook after post title (widget) do_action('wpsight_widget_post_title_after', $width, $id); // Action hook before post content (widget) do_action('wpsight_widget_post_content_before', $width, $id); ?> <div class="post-teaser"> <?php wpsight_the_excerpt(get_the_ID(), true, $length); ?> </div> <?php // Action hook after post content (widget) do_action('wpsight_widget_post_content_after', $width, $id); ?> </div><!-- .widget-inner --> </div><!-- .post.<?php the_ID(); ?> --><?php // Increase loop counter $counter++; } // endwhile have_posts() ?> </div><!-- .widget --> </div><!-- .widget-wrap --><?php } // endif have_posts() // Reset query wp_reset_query(); }
function wpsight_get_listing_details($post_id = '', $details_nr = '', $details = false) { // Get post ID from $post_id if (empty($post_id)) { $post_id = get_the_ID(); } // If still empty, return false if (empty($post_id)) { return false; } // Get post custom data $post_custom = get_post_custom($post_id); // Get standard details $standard_details = wpsight_standard_details(); // Create markup $listing_details = '<div class="listing-details-overview clearfix">'; // Loop through details if (empty($details_nr)) { $details_nr = apply_filters('wpsight_get_listing_details_nr', 3); } // Check if specific details $details = apply_filters('wpsight_get_listing_details', $details); if (is_array($details)) { foreach ($details as $detail) { $pos = strpos($detail, '_'); if ($pos !== false && $pos == 0) { $detail = substr_replace($detail, '', $pos, strlen('_')); } if (!empty($post_custom['_' . $detail][0])) { $i = 1; // Get listing detail $listing_detail = wpsight_get_standard_detail($detail); $listing_details .= '<span class="listing-' . wpsight_dashes($detail) . ' listing-details-detail" title="' . $listing_detail['label'] . '">'; $listing_details .= $post_custom['_' . $detail][0] . ' '; $listing_details .= wpsight_get_measurement_units($standard_details[$detail]['unit']); $listing_details .= '</span><!-- .listing-' . wpsight_dashes($detail) . ' -->' . "\n"; $i++; } } } else { for ($i = 1; $i <= $details_nr; $i++) { if (!isset($post_custom['_details_' . $i][0])) { continue; } $listing_detail_value = $post_custom['_details_' . $i][0]; if (!empty($listing_detail_value)) { // Get listing detail $listing_detail = wpsight_get_standard_detail('details_' . $i); $listing_details .= '<span class="listing-details-' . $i . ' listing-details-detail" title="' . $listing_detail['label'] . '">'; // Check if value is data key if (!empty($listing_detail['data'])) { $listing_detail_value = $listing_detail['data'][$listing_detail_value]; } $listing_details .= $listing_detail_value . ' '; $listing_details .= wpsight_get_measurement_units($standard_details['details_' . $i]['unit']); $listing_details .= '</span><!-- .listing-details-' . $i . ' -->' . "\n"; } } } // Display formatted listing price $listing_details .= '<span class="listing-price">' . wpsight_get_price($post_id) . '</span><!-- .listing-price -->' . "\n"; // Close markup $listing_details .= '</div><!-- .listing-details -->'; return apply_filters('wpsight_listing_details', $listing_details); }