<?php
function lioit_small_box($cat) { ?>
<?php
		global $smof_data;
		global $post;
		$small_cat = stripslashes($smof_data['smallbox_'.$cat]);
		$small_color = $smof_data[$cat.'_scolor'];  
		$category_id = get_cat_ID($small_cat);
		


		
		?>
<div class="smallNewsBox">
<div class="homeTitle" <?php if(!empty($smof_data[$cat.'_scolor'])) { ?> style="border-color:<?php echo $small_color;  ?>;"<?php } ?>><h2 <?php if(!empty($smof_data[$cat.'_scolor'])) { ?>style="background-color:<?php echo $small_color;  ?>;"<?php } ?>><a href="<?php echo get_category_link($category_id); ?>" ><?php echo get_cat_name($category_id); ?></a></h2></div>
  <div class="contentBox">
    <?php query_posts(array('showposts' => 1, 'cat' => $category_id )); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="smallNewsBoxPost">
    
    
      <div class="smallNewsBoxPostThumb ">
        
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <?php the_post_thumbnail('columnsimg', array('title' => strip_tags(get_the_title()))); ?> </a> </div>
      <!--End smallNewsPostThumb-->
     
      <h4 class="smallNewsBoxPostTitle">
        <?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 } ?>
        <a href="<?php the_permalink();?>">
        <?php the_title();?>
        </a></h4>
        <div class="smallNewsBoxPostDetails">
        <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="MetapostDate"><?php the_time('F d, Y'); ?></li>
                                            <li class="postComments"><a href="<?php comments_link();?>"><?php comments_number(__('0 Comments', 'lioit'), __('One Comment', 'lioit'), __('% Comments', 'lioit'));?></a></li>
        </ul>
        <!--End smallNewspostMeta--> 
      </div>
      <p><?php echo excerpt(20); ?></p>
       <a href="<?php the_permalink();?>" class="postMore btn" <?php if(!empty($smof_data[$cat.'_scolor'])) { ?>style="background-color:<?php echo $small_color;  ?>;"<?php } ?>><?php _e('Read More' , 'lioit' ) ?></a>
      <!--End smallNewsPostDetails--> 
    </div>
    <!--End smallNewsBoxPost-->
    <?php endwhile; ?>
    <?php  else:  ?>
    <!-- Else in here -->
    <?php  endif; ?>
    <?php wp_reset_query(); ?>
    <div class="smallNewsBoxList">
      <?php query_posts(array('showposts' => 2,'offset' => 1, 'cat' => $category_id )); ?>
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <div class="smallNewsBoxListPost">
      	
        <div class="smallNewsBoxListPostThumb  smallcover ">
          
          <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"> <?php the_post_thumbnail('thumb-small', array('title' => strip_tags(get_the_title()))); ?></a> </div>
        <!--End smallNewsBoxListPostThumb-->
        <div class="smallNewsBoxListPostDetails">
          <?php $type_badge = get_post_meta($post->ID, 'lioit_post_type', true);?>
      	<h4 class="smallNewsBoxListPostTitle"><?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 } ?><a href="<?php the_permalink();?>">
            <?php the_title();?>
            </a></h4>
          <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="MetapostDate"><?php the_time('F d, Y'); ?></li>
          </ul>
          <!--End postMeta--> 
        </div>
        <!--End smallNewsBoxListPostDetails--> 
      </div>
      <!--End smallNewsBoxListPost-->
      <?php endwhile; ?>
      <?php  else:  ?>
      <!-- Else in here -->
      <?php  endif; ?>
      <?php wp_reset_query(); ?>
    </div>
    <!--End NewsBoxList-->
  
  </div>
  <!--End ContentBox--> 
</div>
<!--End NewsBox-->
<?php
}
?>