<div class="container-fluid py-3">
	<div class="container-fluid px-md-5">
		<div class="row">
		<?php if(get_theme_mod( 'enable_banner_category' )==true) $i = 8;
		else $i = 12; ?>
			<div class="col-lg-<?php echo $i; ?>">
				<div class="owl-carousel owl-carousel-2 carousel-item-1 position-relative mb-3 mb-lg-0">
				<?php $mediapulse_banner_mediapulse_category = get_theme_mod( 'banner_mediapulse_category' );
					$args = array(
					'post_type'=> 'post',
					'orderby'    => 'ID',
					'cat' => $mediapulse_banner_mediapulse_category,
					'post_status' => 'publish',
					'order'    => 'DESC',
					'posts_per_page' => -1 // this will retrive all the post that is published 
					);
					$result = new WP_Query( $args );
					if ( $result->have_posts()): 
					while ( $result->have_posts() ): $result->the_post(); ?>
					<div class="position-relative overflow-hidden" style="height: 530px;">
					<?php if(has_post_thumbnail()) { 
						$mediapulse_featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'mediapulse-full'); ?>
						<img class="img-fluid h-100" src="<?php echo esc_url($mediapulse_featured_img_url); ?>" style="object-fit: cover;">
					<?php } ?>
						<div class="overlay">
							<div class="mb-1">
								<?php the_category( ' , ' ); ?>
								<span class="px-1">/</span>
								<span><?php echo esc_html( get_the_date() ); ?></span>
							</div>
							<a class="h2 m-0 text-white font-weight-bold" href="<?php echo the_permalink(); ?>"><?php the_title(); ?></a>
						</div>
					</div>
					<?php endwhile; endif; ?>
				</div>
			</div>
			
			<?php if(get_theme_mod( 'enable_banner_category',true )==true) : ?>
			<div class="col-lg-4">
				<div class="d-flex align-items-center justify-content-between bg-light py-3 px-4 mb-3">
					<h3 class="m-0"><?php echo esc_html_e('Categories','mediapulse'); ?></h3>
				</div>
				<?php 
				if(get_theme_mod('right_category_0')) {
				$mediapulse_cat = get_theme_mod('right_category_0');
				$mediapulse_category = get_the_category_by_ID($mediapulse_cat);
				$mediapulse_category_link = get_category_link( $mediapulse_cat );
				$mediapulse_image_url = get_term_meta( $mediapulse_cat, 'term_image', true ); ?>
				<?php if($mediapulse_image_url) { ?>
				<div class="position-relative overflow-hidden mb-3" style="height: 100px;">
					<img class="img-fluid w-100 h-100" src="<?php echo esc_url($mediapulse_image_url); ?>" style="object-fit: cover;"> 
					<a href="<?php echo esc_url( $mediapulse_category_link ); ?>" target="_blank" class="overlay align-items-center justify-content-center h4 m-0 text-white text-decoration-none">
						<?php echo esc_html($mediapulse_category); ?>
					</a>
				</div> <?php } ?>
				<?php } ?>
				<?php 
				if(get_theme_mod('right_category_1')) {
				$mediapulse_cat = get_theme_mod('right_category_1');
				$mediapulse_category = get_the_category_by_ID($mediapulse_cat);
				$mediapulse_category_link = get_category_link( $mediapulse_cat );
				$mediapulse_image_url = get_term_meta( $mediapulse_cat, 'term_image', true ); ?>
				<?php if($mediapulse_image_url) { ?>
				<div class="position-relative overflow-hidden mb-3" style="height: 100px;">
					<img class="img-fluid w-100 h-100" src="<?php echo esc_url($mediapulse_image_url); ?>" style="object-fit: cover;">
					<a href="<?php echo esc_url( $mediapulse_category_link ); ?>" target="_blank" class="overlay align-items-center justify-content-center h4 m-0 text-white text-decoration-none">
						<?php echo esc_html($mediapulse_category); ?>
					</a>
				</div>
				<?php } } ?>
				<?php 
				if(!empty(get_theme_mod('right_category_2'))) {
				$mediapulse_cat = get_theme_mod('right_category_2');
				$mediapulse_category = get_the_category_by_ID($mediapulse_cat);
				$mediapulse_category_link = get_category_link( $mediapulse_cat );
				$mediapulse_image_url = get_term_meta( $mediapulse_cat, 'term_image', true ); ?>
				<?php if($mediapulse_image_url) { ?>
				<div class="position-relative overflow-hidden mb-3" style="height: 100px;">
					<img class="img-fluid w-100 h-100" src="<?php echo esc_url($mediapulse_image_url); ?>" style="object-fit: cover;">
					<a href="<?php echo esc_url( $mediapulse_category_link ); ?>" target="_blank" class="overlay align-items-center justify-content-center h4 m-0 text-white text-decoration-none">
						<?php echo esc_html($mediapulse_category); ?>
					</a>
				</div>
				<?php } } ?>
				<?php 
				if(!empty(get_theme_mod('right_category_3'))) {
				$mediapulse_cat = get_theme_mod('right_category_3');
				$mediapulse_category = get_the_category_by_ID($mediapulse_cat);
				$mediapulse_category_link = get_category_link( $mediapulse_cat );
				$mediapulse_image_url = get_term_meta( $mediapulse_cat, 'term_image', true ); ?>
				<?php if($mediapulse_image_url) { ?>
				<div class="position-relative overflow-hidden mb-3" style="height: 100px;">
					<img class="img-fluid w-100 h-100" src="<?php echo esc_url($mediapulse_image_url); ?>" style="object-fit: cover;">
					<a href="<?php echo esc_url( $mediapulse_category_link ); ?>" target="_blank" class="overlay align-items-center justify-content-center h4 m-0 text-white text-decoration-none">
						<?php echo esc_html($mediapulse_category); ?>
					</a>
				</div>
				<?php } } ?>
			</div>
			<?php endif; ?>
		</div>
	</div>
</div>