<?php
/**
 * The template for displaying the smaller thumbnail slideshow.
 *
 * @package WordPress
 * @subpackage Edition
 * @since Edition 1.0
 */
global
$tw_section,	// section object
$grid_size;		// grid size

$tw_section = themewich_section_object();	// section post options

$section_id = get_the_ID($post);			// section id
$grid_size 	= 'halfgrid';					// set grid size   ?>

<?php if ( $tw_section->carousel_width == 'fixed' ) { ?>
<div class="container carousel-container">
	<div class="col-md-12">
<?php } ?>

	<div class='single-carousel info carousel gallery-wrap loading half-carousel <?php echo sanitize_html_class( $tw_section->autoplay ); ?>' data-pause="<?php echo isset($tw_section->delay) ? $tw_section->delay : ''; ?>" data-width="367" data-loop="false" data-space="10" data-moveslides="1" data-pager="false" data-speed="500">
		<ul class="bxslider">
			<?php 
				global $wp_query; // for pagination
				
				// Additional query arguments
				$args = array(
					'ignore_sticky_posts'   => 1,   					// Ignore Sticky Posts
					'post_type'             => array( 'post' ), 		// Get posts
					'nopaging'				=> false,					// Use paging
					'paged'                 => 1,  						// Add pagination
				);

				// Filter the latest posts by type chosen
				$args = themewich_post_args($args);

				wp_reset_query(); 					// Reset query
				$wp_query = new WP_Query($args); 	// Query the posts
		
				// Start the loop
				while ($wp_query->have_posts()) : $wp_query->the_post();  
			?>

			<li class="carouselpost">
				<?php get_template_part(TW_TEMPLATES_DIR .'/template-grid'); ?>
			</li><!--.carouselpost-->

			<?php 
				endwhile; 			// End Loop 
				wp_reset_query(); 	// Reset Query
			?>
		</ul><!--.bxslider-->
	</div><!--.single-carousel-->
<?php if ( $tw_section->carousel_width == 'fixed' ) { ?>
	</div><!--.col-md-12-->
</div><!--.container-->
<?php } ?>