<section class="featuredSectionFull">
<div class="container">
<section class="featuredSection row">
 
    <div class="span7">
<?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_slider1'
	   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 id="featuredSection-slider">
        <div class="slider-nav">
          
        </div>
        <div class="flex-viewport">
          <ul class="slides">
            <?php 
                
                                $i = 0;
                                if ($pageposts):
                                foreach ($pageposts as $post):
                                setup_postdata($post); 
                                $i++;
                                if ($i <= 12) {
                                ?>
            <li class="clone"> <a href="<?php the_permalink();?>">
              
               <?php the_post_thumbnail('slider1', array('title' => strip_tags(get_the_title()))); ?>	</a>
              <div class="slider-text">
                <div class="wrap">
                  <h4> <a href="<?php the_permalink();?>">
                    <?php the_title(); ?>
                    </a> </h4>
                  <p><?php echo excerpt(16); ?></p>
                </div>
              </div>
            </li>
            <?php } 
                                    endforeach; 	
                                endif; 
                                wp_reset_query();?>	
          </ul>
        </div>
      </div>
      <script type="text/javascript">
jQuery(document).ready(function($) {
	
	
	
	jQuery('#featuredSection-slider').flexslider({						// slider settings
			animation: "slide",								// animation style
			controlNav: false,								// slider thumnails class
			slideshow: true,								// enable automatic sliding
			directionNav: true,								// disable nav arrows
			slideshowSpeed: 3000,   							// slider speed
			smoothHeight: false,
			controlsContainer: "#featuredSection-slider .slider-nav",
			mousewheel: false,  
	});
	
	
});
</script> 
<?php }else{ ?>
<?php }?>
    </div>
    <!--End Span7-->
    <div class="span5">
      <div class="featuredPostsList mainBox">
        <div class="featuredPostsListContent">
          <div class="titleTopTitle">
            <h2><i class="icon-heart-2"></i>
              <?php _e('Featured Posts','lioit') ?>
            </h2>
            <span class="titleBorder"></span> </div>
          <!--End Latest PostsTitle-->
          <ul>
            <?php 
                                           $current_year = date('Y');
                                            $current_month = date('m');
                                        ?>
            <?php query_posts(array(  'ignore_sticky_posts' => 1,'year'=> $current_year,'monthnum' => $current_month, 'showposts' => 4, 'orderby' => "comment_count")); ?>
            <?php $i = 0;  global $post; if ( have_posts() ) : while ( have_posts() ) : the_post(); $i++; ?>
            <li>
              <div class="lioLatestPost">
              	<span class="postNumber"><?php echo $i; ?></span>
                <div class="liopostThumb">
                  
                  <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <?php the_post_thumbnail('main-block', array('title' => strip_tags(get_the_title()))); ?> </a> </div>
                <!--End Post Thumb-->
                <h4> <a href="<?php the_permalink(); ?>">
                  <?php 
                                                        $badge_text = get_post_meta($post->ID, 'lioit_post_badge_text', true);
                                                        $badge_color = get_post_meta($post->ID, 'lioit_post_badge_color', true);
                                                    ?>
                  <?php if ($badge_text) { ?>
                  <div class="articleType" style="background-color:<?php echo $badge_color; ?>;"><?php echo $badge_text; ?></div>
                  <?php } ?>
                  <?php the_title(); ?>
                  </a> </h4>
                <div class="lioPosMeta"><?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'){ ?>
                                           
                                            	<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>
                                           
											<?php } ?>
                                            <span class="postViews"><?php echo getPostViews($post->ID); ?> </span><span class="postComments"><a href="<?php comments_link();?>">
                  <?php comments_number(__('0 Comments', 'lioit'), __('One Comment', 'lioit'), __('% Comments', 'lioit'));?>
                  </a></span> </div>
              </div>
            </li>
            <?php endwhile; ?>
            <?php  endif; ?>
            <?php wp_reset_query(); ?>
          </ul>
        </div>
        <!--End MainBox--> 
      </div>
      <!--End featuredPostsList--> 
    </div>
    <!--End Span5--> 

</section><!--End featuredSection-->
</div><!--End container-->

</section><!--End featuredSectionFull-->