<?php
global $smof_data;
	 $querydetails = "
	   SELECT wposts.*
	   FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
	   WHERE wposts.ID = wpostmeta.post_id
	   AND wpostmeta.meta_key = 'lioit_slider3'
	   AND wpostmeta.meta_value = '1'
	   AND wposts.post_status = 'publish'
	   AND wposts.post_type = 'post'
	   ORDER BY wposts.post_date DESC
	 ";

	 $pageposts = $wpdb->get_results($querydetails, OBJECT);
	 
	 
	 if ($pageposts == true){
?>
<section class="featuredColumnsPosts container">
                  
                            <div class="homeTitle"><h2><i class="icon-reorder"></i> <?php _e('HOTSTUFF','lioit') ?></h2><div class="carouselControl">
                           <a class="topcarousel-prev buttonShadow" href="#"><i class="icon-angle-left"></i></a>
                           <a class="topcarousel-next buttonShadow" href="#"><i class="icon-angle-right"></i></a>
                      </div><!--End Control--></div>
								<ul id="featuredColumnsPostsList">
                                 <?php 
                
                                $i = 0;
                                if ($pageposts):
                                foreach ($pageposts as $post):
                                setup_postdata($post); 
                                $i++;
                                if ($i <= 12) {
                                ?>
                                	<li class="featuredColumnsPostsLi">
                                    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
												
                                            <div class="latestPostThumb ">
                                                
                                                
                                                <a href="<?php the_permalink(); ?>" class="tooltip top" title="<?php the_title(); ?>"> 
                                        <?php the_post_thumbnail('main-block', array('title' => strip_tags(get_the_title()))); ?>
                                        </a>
                                              
                                            </div><!--End LatestPostThumb-->
                                            
                                            <div class="columnPostMeta">
                                                <ul class="postMeta">
                                                	<?php
													$lioit_review_enable =  get_post_meta($post->ID, 'lioit_review_enable', true);
													$lioit_review_type =  get_post_meta($post->ID, 'lioit_review_type', true);
													$lioit_final_score =  get_post_meta($post->ID, 'lioit_final_score', true);
													$lioit_final_percentage = $lioit_final_score * 20 ;
													?>
													<?php if($lioit_review_enable == 'enable'){ ?>
													<li>
														<span class="lioit-rating lioit-rating-<?php echo esc_html($lioit_review_type); ?>">
															<span style="width:<?php echo esc_html($lioit_final_percentage); ?>%;"></span>
														</span>
													</li>
													<?php } ?>
													<li class="postViews"><?php echo getPostViews($post->ID); ?> </li>
                                                    <li class="postComments"><a href="<?php comments_link();?>"><?php comments_number(__('0 Comments', 'lioit'), __('One Comment', 'lioit'), __('% Comments', 'lioit'));?></a></li>
                                                </ul><!--End postMeta-->
                                            </div><!--End columnPostMeta-->
                                        </article><!--End Post-->
                                    </li>
                                     <?php } 
                                    endforeach; 	
                                endif; 
                                wp_reset_query();?>	
                                </ul>
                            
               
                </section><!--End featuredColumnsPosts-->
                <script type="text/javascript">
    
        jQuery(document).ready(function($){
        // jQuery("html").niceScroll();
        $('#featuredColumnsPostsList').carouFredSel({
            auto: false,
            prev: '.topcarousel-prev',
            next: '.topcarousel-next',
            mousewheel: true,
            swipe: {
                onMouse: true,
                onTouch: true
            }
        });
        });
</script>

<?php }else{ ?>
<?php }?>