<?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_slider2'
	   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){
?>
<div class="featuredcarousel container">
            	<div id="featured" class="carousel owl">
					<?php 
                
                                $i = 0;
                                if ($pageposts):
                                foreach ($pageposts as $post):
                                setup_postdata($post); 
                                $i++;
                                if ($i <= 12) {
                                ?>
                    <article>
                        <div class="post front">
                            <div class="post-gallery">
                                <?php the_post_thumbnail('columnsimg', array('title' => strip_tags(get_the_title()))); ?>
                                <div class="overlay"></div>
                            </div>
                            <div class="post-title">
                            
                                <h6><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h6>
                                
                            </div>
                        </div>
                        <div class="post back">
                            <div class="post-title">
                            
                                <h6><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h6>
                                <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"><i class="icon-eye-open"></i><?php echo getPostViews($post->ID); ?> </li>
                                                </ul><!--End postMeta-->
                                <div class="post-content">
                                    <p><?php the_excerpt_max_charlength('100'); ?> ...</p>	
                                    <a class="readmore" href="<?php the_permalink() ?>"><?php _e( 'Read More', 'lioit' ); ?></a>
                                    
                                </div>
                            </div>
                            
                        </div>
                    </article>
                    <?php } 
                                    endforeach; 	
                                endif; 
                                wp_reset_query();?>	
                </div><!--End Row-->
            </div><!--End Container-->
           <script type="text/javascript">
    
       
		jQuery(document).ready(function() {
 
  jQuery("#featured").owlCarousel({
    navigation : true,
	scrollPerPage : false,
	lazyEffect : "fade",
    pagination : false,
	items : 4,
    paginationNumbers: false,
    responsive: true,
    responsiveRefreshRate : 200,
    responsiveBaseWidth: window,
	navigationText : ['<i class="icon-angle-left"></i>','<i class="icon-angle-right"></i>'],
    lazyLoad : true,
  });
 
});
</script>

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