<?php

/**
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */

function citymag_vertical_featured_posts_slideshow($args, $section_title) {

	?>

	<div class="vertical-featured-posts-section vertical-overlay-carousel-section">
		
		<div class="featured-posts-head">
			
			<h4><?php echo esc_html($section_title);?></h4>
			<div class="featured-posts-navigation vertical-featured-posts-navigation"></div>

		</div>

		<div class="vertical-featured-posts-slideshow vertical-overlay-carousel featured-posts-slideshow citymag-slick-container">

			<?php

				$vertical_slideshow_query = new WP_Query($args);
				
				if( $vertical_slideshow_query->have_posts() ) :  while( $vertical_slideshow_query->have_posts() ) : $vertical_slideshow_query->the_post();
			
					$thumb = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()), 'citymag_featured_post_large');
					$imgBackground = (isset($thumb[0])) ? ' style="background-image:url(' . esc_url($thumb[0]) . ')"' : '';
					$overlayPostCSSClass = (!isset($thumb[0])) ? ' overlay-article-placeholder' : '';

			?>

					<div class="featured-posts-overlay-container" >

						<div class="featured-posts-overlay-article<?php echo esc_attr($overlayPostCSSClass);?>" <?php echo $imgBackground; ?>>
						
							<a class="featured-posts-image-link" href="<?php echo esc_url(get_permalink()); ?>"></a>

							<div class="featured-posts-content">

								<p class="category"><?php the_category(' ');?></p>
								<h2><a href="<?php echo esc_url(get_permalink()); ?>"><?php echo esc_html(get_the_title()); ?></a></h2>

							</div>

						</div>

					</div>
		
			<?php

				endwhile;
				wp_reset_postdata();
				endif;
		
			?>     


		</div>

	</div>

	<?php

}
	
?>