<?php

/**

 * The template for displaying featured posts on category pages

 *

 * @package GameKing

 * @subpackage Template

 * @since GameKing 1.0

 */

?>



<?php 

	$args = (array)get_option('home_featured');

	// If user set 'Post Number' to 0 or leave it empty in theme options, return.

	if(empty($args['posts_per_page']))

		return;

	$args['posts_per_page'] = 14;

	

	$args = dp_parse_query_args($args);

	$query = new WP_Query($args); 

	

	if($query->have_posts()):



		// Load scripts only when needed

		wp_enqueue_script('jquery-carousel');

		

		// Get items

		$items = '';

		$i = 0;

		while ($query->have_posts()) : $query->the_post(); 

 

			$thumb_html = dp_thumb_html('custom-small', '', '', false);					//	$thumb_html = get_post_meta('mabp_thumbnail_url');

			

			// Build classname

			$classes = array();

			$classes[] = is_video() ? 'item-video' : 'item-post';

			$class = implode(' ', $classes);

			

			$items .= '<li class="'.$class.'">'.$thumb_html.'</li>';

		endwhile; ?>

	

	<div class="cat-featured">

		<div class="carousel fcarousel fcarousel-6 wrap cf"><div class="box-header"><h2 class="box-title">latest games</h2></div>

		<div class="carousel-container"><div class="carousel-games" >

		

				<ul class="carousel-list"><?php echo $items; ?></ul>

		</div><!-- end .carousel-games -->

			

			<div class="carousel-prev"></div>

			<div class="carousel-next"></div>

		</div><!-- end .carousel-container -->

		</div><!-- end .carousel -->

	</div><!-- end .cat-featured -->



	<?php endif; wp_reset_query(); ?>