<?php if ( get_theme_mod('the_travel_booking_popular_tours_enable') ) : ?>

<?php $args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('the_travel_booking_popular_tours_category'),
  'posts_per_page' => get_theme_mod('the_travel_booking_popular_tours_number'),
); ?>

<div class="popular-tours pt-5">
  <div class="container">
    <div class="owl-carousel">
      <?php $the_travel_booking_arr_posts = new WP_Query( $args );
      if ( $the_travel_booking_arr_posts->have_posts() ) :
        while ( $the_travel_booking_arr_posts->have_posts() ) :
          $the_travel_booking_arr_posts->the_post();
          ?>
          <div class="tour-main-box wow zoomIn">
            <div class="tour-image-box">
             <?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;
          ?>
              <?php if( get_post_meta($post->ID, 'the_travel_booking_popular_tours_amount', true) ) {?>
                <p class="tour-price mb-0"><?php echo esc_html(get_post_meta($post->ID,'the_travel_booking_popular_tours_amount',true)); ?></p>
              <?php }?>
            </div>
            <div class="tour-inner-box p-3">
              <h3><a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php the_title(); ?></a></h3>
              <p class="mb-0"><?php echo wp_trim_words( get_the_content(), get_theme_mod('the_travel_booking_excerpt_number_count',15) ); ?></p>
            </div>
            <?php if( get_post_meta($post->ID, 'the_travel_booking_popular_tours_days', true) || get_post_meta($post->ID, 'the_travel_booking_popular_tours_star_ratings', true) || get_post_meta($post->ID, 'the_travel_booking_popular_tours_country_city', true) ){?>
              <div class="tour-meta-box p-2">
                <?php if( get_post_meta($post->ID, 'the_travel_booking_popular_tours_days', true) ) {?>
                  <span><i class="far fa-calendar-alt me-2"></i><?php echo esc_html(get_post_meta($post->ID,'the_travel_booking_popular_tours_days',true)); ?></span>
                <?php }?>

                <?php if( get_post_meta($post->ID, 'the_travel_booking_popular_tours_star_ratings', true) ) {?>
                  <span><i class="fas fa-star me-2"></i><?php echo esc_html(get_post_meta($post->ID,'the_travel_booking_popular_tours_star_ratings',true)); ?></span>
                <?php }?>

                <?php if( get_post_meta($post->ID, 'the_travel_booking_popular_tours_country_city', true) ) {?>
                  <span><i class="fas fa-map-marker-alt me-2"></i><?php echo esc_html(get_post_meta($post->ID,'the_travel_booking_popular_tours_country_city',true)); ?></span>
                <?php }?>
              </div>
            <?php }?>
          </div>
        <?php
      endwhile;
      wp_reset_postdata();
      endif; ?>
    </div>
  </div>
</div>

<?php endif; ?>
