<?php if ( get_theme_mod('data_analytics_center_latest_update_section_enable',false) ) : ?>

<?php $data_analytics_center_left_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('data_analytics_center_latest_update_category'),
  'posts_per_page' => get_theme_mod('data_analytics_center_latest_update_number'),
);

$data_analytics_center_right_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('data_analytics_center_latest_update_list'),
  'posts_per_page' => get_theme_mod('data_analytics_center_latest_update_list_number'),
);

?>

	<div id="trending" class="py-5">
		<div class="container">
			<div class="text-center">
				<?php if ( get_theme_mod('data_analytics_center_latest_update_heading') ) : ?>
	    		<h2 class="mb-4  wow fadeInDown"><?php echo esc_html(get_theme_mod('data_analytics_center_latest_update_heading'));?></h2>
	    	<?php endif; ?>
	    </div>
	    <div class="row">
	    	<div class="col-lg-8 col-md-8 align-self-center">
	    		<div class="owl-carousel">
						<?php $data_analytics_center_arr_posts = new WP_Query( $data_analytics_center_left_args );
					    if ( $data_analytics_center_arr_posts->have_posts() ) :
				      while ( $data_analytics_center_arr_posts->have_posts() ) :
			        $data_analytics_center_arr_posts->the_post(); ?>
			        <div class="trending_post mb-3 wow fadeInUp">
			        	<div class="trending_image">
		              <?php
				            if ( has_post_thumbnail() ) :
				              the_post_thumbnail();
				            else:
				              ?>
				              <div class="slider-alternate">
				                <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/banner.png'; ?>">
				              </div>
				              <?php
				            endif;
				          ?>
				          <div class="trending_category">
											<?php
												$data_analytics_center_categories = get_the_category();
												if ( ! empty( $data_analytics_center_categories ) ) {
												    echo esc_html( $data_analytics_center_categories[0]->name );   
												}
											?>
									</div>
								</div>
	              <h3><a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php the_title(); ?></a></h3>
	              <div class="post-meta my-3">
	                <span><i class="far fa-user me-2"></i> <?php the_author(); ?></span>
	                <span class="ms-3"><i class="far fa-calendar-alt me-2"></i> <?php the_date(); ?></span>
              	</div>
		        	</div>
				    <?php
				    endwhile;
				    wp_reset_postdata();
				    endif; ?>
					</div>
	    	</div>
	    	<div class="col-lg-4 col-md-4  wow fadeInRight">
	    		<?php if ( get_theme_mod('data_analytics_center_recent_post_heading') ) : ?>
	    			<h2 class="mb-4"><?php echo esc_html(get_theme_mod('data_analytics_center_recent_post_heading'));?></h2>
	    		<?php endif; ?>
	    		<?php $data_analytics_center_right_posts = new WP_Query( $data_analytics_center_right_args );
				    if ( $data_analytics_center_right_posts->have_posts() ) :
			      while ( $data_analytics_center_right_posts->have_posts() ) :
		        $data_analytics_center_right_posts->the_post(); ?>
		        <div class="recent_post mb-3">
              <h3><a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php the_title(); ?></a></h3>
        	 		<div class="post-meta my-3">
                <span><i class="far fa-user me-2"></i> <?php the_author(); ?></span>
                <span class="ms-3"><i class="far fa-calendar-alt me-2"></i> <?php the_date(); ?></span>
              </div>
	        	</div>
			    <?php
			    endwhile;
			    wp_reset_postdata();
			    endif; ?>
	    	</div>
	    </div>
		</div>
	</div>
<?php endif; ?>