<?php
/**
 * Template part for displaying category tab section
 *
 * @package Holiday Vacation
 * @subpackage holiday_vacation
 */

?>
<?php $holiday_vacation_static_image= get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; ?>
<?php if( get_theme_mod( 'holiday_vacation_category_tab_enable',true ) != '') { ?>
<section id="entertainment-tab-block">
  <div class="container">
    <?php if(get_theme_mod('holiday_vacation_category_tab_heading')!=''){ ?>
          <h2 class="text-center"><?php echo esc_html(get_theme_mod('holiday_vacation_category_tab_heading')); ?><hr></h2>
    <?php } ?>
        <div class="tab_list mb-4">
            <ul class="nav nav-tabs" role="tablist">
              <?php 
              for($holiday_vacation_i=1; $holiday_vacation_i<=6; $holiday_vacation_i++ ) {?>
                  <li class="nav-item text-center">
                    <?php if(get_theme_mod('holiday_vacation_entertainment_tab_tab_title'.$holiday_vacation_i)!=''){ ?>
                      <i class="<?php echo esc_attr(get_theme_mod('holiday_vacation_tab_icon'.$holiday_vacation_i)); ?>"></i>
                      <a class="nav-link <?php if($holiday_vacation_i == 1){ echo 'active'; } ?>" href="javascript:void(0)" data-bs-toggle="tab" data-bs-target="#entertainment_tab<?php echo esc_attr($holiday_vacation_i);?>" role="tab" aria-controls="entertainment_tab<?php echo esc_attr($holiday_vacation_i);?>" aria-selected="true">
                        <?php echo esc_html(get_theme_mod('holiday_vacation_entertainment_tab_tab_title'.$holiday_vacation_i)); ?>
                      </a>
                    <?php } ?>
                  </li>
              <?php } ?>
            </ul>
        </div>
    <div class="tab-content entertainment_tab_content">
        <?php 
        for($holiday_vacation_i=1; $holiday_vacation_i<=6; $holiday_vacation_i++ ) {?>
        <div role="tabpanel" class="tab-pane <?php if($holiday_vacation_i == 1){echo 'active';} ?>" id="entertainment_tab<?php echo esc_attr($holiday_vacation_i);?>">
          <div class="row">
              <?php
              $holiday_vacation_k = 1;
                $holiday_vacation_args = array(
                  'post_type' => 'post',
                  'post_status' => 'publish',
                  'category_name' => get_theme_mod('holiday_vacation_entertainment_tab_category_one'.$holiday_vacation_i),
                  'order' => 'ASC'
                );  
                $holiday_vacation_query = new WP_Query($holiday_vacation_args); 
                if ( $holiday_vacation_query->have_posts() ) :  while ($holiday_vacation_query->have_posts()) : $holiday_vacation_query->the_post(); 
                ?>
                <div class="col-lg-3 col-md-4 col-sm-6 mb-4">
                  <div class="food-tab-boxes food-tab-box<?php echo esc_attr($holiday_vacation_k); ?> mb-3" >
                    <div class="post-image-block-outer">
                          <?php if(has_post_thumbnail()){ ?>
                          <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($holiday_vacation_static_image).'">'); } ?>
                          <div class="news-inner">
                            <h3 class="mt-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                            <?php 
                              if (function_exists('kksr_freemius')) { 
                                echo kk_star_ratings(); 
                              }
                            ?>
                          </div>
                    </div>
                  </div>
                </div>
              <?php $holiday_vacation_k++; endwhile; endif; ?>
          </div>
        </div>
      <?php } ?>
    </div>
  </div>
</section>
<?php }?>
