<?php
if ( ! get_theme_mod( 'cleaning_services_agent_enable_banner_section', true ) ) {
	return;
}

$cleaning_services_agent_slider_content_ids  = array();
$cleaning_services_agent_slider_content_type = get_theme_mod( 'cleaning_services_agent_banner_slider_content_type', 'post' );

for ( $cleaning_services_agent_i = 1; $cleaning_services_agent_i <= 3; $cleaning_services_agent_i++ ) {
	$cleaning_services_agent_slider_content_ids[] = get_theme_mod( 'cleaning_services_agent_banner_slider_content_' . $cleaning_services_agent_slider_content_type . '_' . $cleaning_services_agent_i );
}
$cleaning_services_agent_banner_slider_args = array(
	'post_type'           => $cleaning_services_agent_slider_content_type,
	'post__in'            => array_filter( $cleaning_services_agent_slider_content_ids ),
	'orderby'             => 'post__in',
	'posts_per_page'      => absint( 3 ),
	'ignore_sticky_posts' => true,
);
$cleaning_services_agent_banner_slider_args = apply_filters( 'cleaning_services_agent_banner_section_args', $cleaning_services_agent_banner_slider_args );

cleaning_services_agent_render_banner_section( $cleaning_services_agent_banner_slider_args );

/**
 * Render Banner Section.
 */
function cleaning_services_agent_render_banner_section( $cleaning_services_agent_banner_slider_args ) { ?>

	<section id="cleaning_services_agent_banner_section" class="banner-section banner-style-1">
		<?php
		if ( is_customize_preview() ) :
			cleaning_services_agent_section_link( 'cleaning_services_agent_banner_section' );
		endif;
		?>
		<div class="banner-section-wrapper">
			<?php
			$cleaning_services_agent_query = new WP_Query( $cleaning_services_agent_banner_slider_args );
			if ( $cleaning_services_agent_query->have_posts() ) :
				?>
				<div class="asterthemes-banner-wrapper banner-slider cleaning-services-agent-carousel-navigation" data-slick='{"autoplay": false }'>
					<?php
					$cleaning_services_agent_i = 1;
					while ( $cleaning_services_agent_query->have_posts() ) :
						$cleaning_services_agent_query->the_post();
						?>
						<div class="banner-single-outer">
							<div class="banner-single">
								<div class="banner-img">
									<?php if ( has_post_thumbnail() ) : ?>
									    <?php the_post_thumbnail( 'full' ); ?>
									<?php else : ?>
									    <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/resource/img/default.png" />
									<?php endif; ?>
								</div>
								<div class="banner-caption">
									<div class="asterthemes-wrapper">
										<div class="banner-catption-wrapper wow fadeInDown" data-wow-duration="1.5s">
											<a href="<?php the_permalink(); ?>">
												<h1 class="banner-caption-title">
												    <?php
												    $cleaning_services_agent_title = get_the_title();
												    echo $cleaning_services_agent_title;
												    ?>
												    
												</h1>
											</a>
										</div>
									</div>
								</div>
							</div>
						</div>
						<?php
						$cleaning_services_agent_i++;
					endwhile;
					wp_reset_postdata();
					?>
				</div>
				<?php
			endif;
			?>
		</div>
	</section>
	<?php
}