<?php

if ( class_exists( 'Wp_Travel_Engine' ) ) {
    ?>
  <?php 
    if ( get_theme_mod( 'best_tours_display_option', true ) ) {
        ?>
    
    <?php 
        $title = get_theme_mod( 'best_tours_title', '' );
        $category_id = get_theme_mod( 'best_tours_category', '' );
        $number_of_posts = get_theme_mod( 'number_of_best_tours', 8 );
        $args = array(
            'post_type'      => 'trip',
            'posts_per_page' => $number_of_posts,
        );
        if ( !empty( $category_id ) ) {
            $args['tax_query'] = array(array(
                'taxonomy' => 'trip_types',
                'field'    => 'id',
                'terms'    => $category_id,
            ));
        }
        $query = new WP_Query($args);
        set_query_var( 'title', $title );
        set_query_var( 'query', $query );
        ?>

    <?php 
        if ( $query->have_posts() ) {
            ?>

      <?php 
            get_template_part( 'layouts/homepage/trips/trip-layout', 'one' );
            ?>
    <?php 
        }
        ?>

  <?php 
    }
}