コード例 #1
0
    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()
    }
コード例 #2
0
    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()
    }
コード例 #3
0
ファイル: functions.php プロジェクト: phucanh92/vietlong
/**  
 *	Function to build properties list
 *	@param array $query: data return from WP_Query function
 *	@param string $width: width class of each prorperty in list
 *	@param string $clear: clear float class - 'clear' or ''
 *	@param int $length: number of words displayed in property's excerp
 *	
 */
function build_property_list($query, $blockTitle = '', $order = true, $compare = true, $filter = false, $width = 'span3', $clear = '', $length = 25)
{
    if ($query->have_posts()) {
        $id = 'home-bottom';
        ?>
		<div id="properties-row">
		<?php 
        if ($blockTitle != '') {
            // If has title
            ?>
		<div class="title title-widget clearfix">
			<h2><?php 
            echo $blockTitle;
            ?>
</h2>
			<?php 
            if ($compare) {
                ?>
				<div class="title-actions title-actions-compare">
					<button id="fe-favorites-compare" class="btn btn-mini"><i class="icon-th"></i> <?php 
                _e('Compare', 'wpsight');
                ?>
</button>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($order) {
                ?>
				<?php 
                buildOrderOptions();
                ?>
			<?php 
            }
            ?>
		</div>
		<?php 
        }
        // End if block title
        if ($filter) {
            $filterOptions = custom_subpages_filter_form_details();
            echo buildFilterForm($filterOptions);
        }
        ?>
		
		<div class="widget widget-latest row">
		<?php 
        while ($query->have_posts()) {
            // Set up post data
            $query->the_post();
            ?>
			
			<div <?php 
            post_class($width . $clear . ' clearfix');
            ?>
>
			
				<div class="widget-inner">
				
					<?php 
            // Action hook before post 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 post title (widget)
            do_action('wpsight_widget_listing_title_after', $width, $id);
            // Action hook before post 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 
            if ($compare) {
                $attr = array();
                echo build_compare_table($attr);
            }
            // Action hook after post 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> <!-- End properties list -->
		<?php 
        if ($order) {
            wpsight_pagination($favorites_query->max_num_pages);
        }
        ?>
		</div> <!-- End container -->
	<?php 
    } else {
        if ($blockTitle != '') {
            // If has title
            ?>
		<div class="title title-widget clearfix">
			<h2><?php 
            echo $blockTitle;
            ?>
</h2>
		</div>
		<div class="property-list-empty"> <?php 
            echo __('No property found.', 'wpsight');
            ?>
</div>
		<?php 
        }
        // End if block title
    }
    wp_reset_query();
}
コード例 #4
0
ファイル: loop-subpages.php プロジェクト: phucanh92/vietlong
        the_title_attribute();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
			    	
			    	</div>	    	
			    	
			    	<?php 
        // Set custom excerpt length on parent page
        $custom_excerpt_length = get_post_meta($page_id, 'excerpt_length', true);
        // If custom excerpt length empty, set it to 25 (filtrable)
        $excerpt_length = $custom_excerpt_length ? $custom_excerpt_length : apply_filters('wpsight_excerpt_length_subpages', 25);
        // Display page excerpt
        wpsight_the_excerpt(get_the_ID(), false, $excerpt_length);
        ?>
			
			    </div><!-- .page --><?php 
        // Increase counter
        $i++;
    }
    // endwhile $subpages
    ?>
	    
	    </div><!-- .row -->
	
	</div><!-- #subpages --><?php 
}
// endif $subpages
// Restore original query
コード例 #5
0
ファイル: loop.php プロジェクト: phucanh92/vietlong
    		<?php 
// Action hook post title inside
do_action('wpsight_post_title_inside');
the_title();
?>
    	</a>
    </h2>
    
    <?php 
// Action hook after post title
do_action('wpsight_post_title_after');
// Action hook before post content
do_action('wpsight_post_content_before');
?>
    	
    <div class="post-teaser clearfix">
    	<?php 
wpsight_the_excerpt(get_the_ID(), true, apply_filters('wpsight_excerpt_length', 25));
?>
    </div>
    
    <?php 
// Action hook after post content
do_action('wpsight_post_content_after');
?>
    			
</div><!-- .post-<?php 
the_ID();
?>
 -->
コード例 #6
0
ファイル: latest.php プロジェクト: phucanh92/vietlong
    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();
    }