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

<?php $professional_blogger_left_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('professional_blogger_trending_category'),
  'posts_per_page' => get_theme_mod('professional_blogger_trending_number'),
); ?>

	<div id="trending" class="py-5">
		<div class="container">
			<div class="row">
				<div class="col-lg-6 col-md-6 align-self-center wow fadeInLeft">
					<?php if ( get_theme_mod('professional_blogger_trending_heading') ) : ?>
		    		<h2 class="mb-0"><?php echo esc_html(get_theme_mod('professional_blogger_trending_heading'));?></h2>
		    	<?php endif; ?>
		    </div>
				<div class="col-lg-6 col-md-6 align-self-center text-lg-end text-md-end wow fadeInRight">
					<?php if ( get_theme_mod('professional_blogger_header_button_link') ) : ?>
						<div class="header-button">
		  				<a href="<?php echo esc_url(get_theme_mod('professional_blogger_header_button_link'));?>"><?php esc_html_e('View All','professional-blogger'); ?></a>
  		  		</div>
      		<?php endif; ?>
		    </div>
    	</div>
			<div class="row mt-5">
				<?php $professional_blogger_arr_posts = new WP_Query( $professional_blogger_left_args );
			    if ( $professional_blogger_arr_posts->have_posts() ) :
			      while ( $professional_blogger_arr_posts->have_posts() ) :
			        $professional_blogger_arr_posts->the_post(); ?>
			        <div class="col-lg-4 col-md-6 col-sm-6">
								<div class="trending-box wow zoomIn">
									<div class="trending-image">
										<?php
					            if ( has_post_thumbnail() ) :
					              the_post_thumbnail();
					            else:
					              ?>
					              <div class="trending-image">
					                <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/banner.png'; ?>">
					              </div>
					              <?php
					            endif;
					          ?>
				            <?php the_category(); ?>
				          </div>
									<h3><a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php the_title(); ?></a></h3>
								</div>
							</div>
			    <?php
			    endwhile;
			    wp_reset_postdata();
			    endif; ?>
			</div>
		</div>
	</div>
<?php endif; ?>