<?php

$slider_section = get_theme_mod('vastnews_slider_display',true);
if ( false === $slider_section ) {
	return;
}
$post_number = get_theme_mod('vastnews_post_number','4');
$post_category = get_theme_mod('vastnews_post_category','');

?>

<div class="main-banner-section">
	<div class="theme-wrapper">
		<div class="banner-slider">
				<?php
				$block_args = array( 
					'post_type'      => 'post',
					'posts_per_page' => absint($post_number),
					'order'			 => 'DESC',
					'orderby'		 => 'date',	
					'cat'            => $post_category,
				);
				$block_query = new WP_Query( $block_args );
					if( $block_query -> have_posts() ) :
						while( $block_query -> have_posts() ) : $block_query -> the_post();
						?>

							<div class="slider-item">

							<?php if (has_post_thumbnail()) {  

								  		vastnews_post_thumbnail(); 
									}
								  else {
										?>
										<img src="<?php echo esc_url(get_template_directory_uri().'/assets/images/slidercolor.png') ?>" class="img-responsive" alt="...">
										<?php 
									} ?>

								<div class="slider-image-overlay">
									<div class="slider-info">
										<?php $category_list = get_the_category_list( ', ' ); ?>		

											<?php if ( $category_list ) : ?>
											<div class="slider-cat">
												<?php echo '' . $category_list; ?>
											</div> 
											<?php endif; ?>

											<h3 class="slider-title"> 
												<a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a>	
											</h3>

											<div class="slider-date"><?php the_time( get_option('date_format') ); ?></div>

									</div>
								</div>
							</div>			
						<?php
						endwhile;
					endif;
				?>
		</div>
	</div>
</div>
