<?php
/**
 * Template part for displaying category tab section
 *
 * @package Stylish Blog
 * @subpackage stylish_blog
 */

?>
<?php $stylish_blog_static_image = get_stylesheet_directory_uri() . '/assets/images/sliderimage.png'; ?>
<?php if( get_theme_mod( 'stylish_blog_category_tab_enable',true ) != '') { ?>

<section id="entertainment-tab-block">
  <div class="container">
    <div class="row">
      <div class="col-lg-5 col-md-5 col-sm-5 mb-2">
        <div class="business-tab-head section_main_head pb-4 d-block">
          <div class="media">
            <div class="media-body">
              <div class="row">
                <?php if(get_theme_mod('stylish_blog_category_tab_heading')!='' || get_theme_mod('stylish_blog_category_tab_sub_heading')){ ?>
                  <div class="col-lg-4 col-4 align-self-center text-center">
                    <i class="far fa-edit me-5"></i>
                  </div>
                  <div class="col-lg-8 col-8 align-self-center p-lg-0">
                      <h3>
                        <?php echo esc_html(get_theme_mod('stylish_blog_category_tab_heading')); ?>
                      </h3>
                      <div class="section-text">
                        <?php echo esc_html(get_theme_mod('stylish_blog_category_tab_sub_heading')); ?>
                      </div>
                  </div>
                <?php } ?>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="col-lg-7 col-md-7 col-sm-7 mb-2">
        <div class="tab_list">
            <ul class="nav nav-tabs" role="tablist">
              <?php 
              for($i=1; $i<=5; $i++ ) {?>
                  <li class="nav-item">
                    <?php if(get_theme_mod('stylish_blog_entertainment_tab_tab_title'.$i)!=''){ ?>
                      <a class="nav-link <?php if($i == 1){ echo 'active'; } ?>" href="javascript:void(0)" data-bs-toggle="tab" data-bs-target="#entertainment_tab<?php echo esc_attr($i);?>" role="tab" aria-controls="entertainment_tab<?php echo esc_attr($i);?>" aria-selected="true">
                        <?php echo esc_html(get_theme_mod('stylish_blog_entertainment_tab_tab_title'.$i)); ?>
                      </a>
                    <?php } ?>
                  </li>
              <?php } ?>
            </ul>
        </div>
      </div>
    </div>
    <div class="tab-content entertainment_tab_content">
      <?php 
      for($i=1; $i<=5; $i++ ) {?>
        <div role="tabpanel" class="tab-pane <?php if($i == 1){echo 'active';} ?>" id="entertainment_tab<?php echo esc_attr($i);?>">
          <div class="row">
            <div class="col-lg-4 col-md-12">
              <?php
              $stylish_blog_k = 1;
                $stylish_blog_args = array(
                  'post_type' => 'post',
                  'post_status' => 'publish',
                  'category_name' => get_theme_mod('stylish_blog_entertainment_tab_category_one'.$i),
                  'order' => 'ASC'
                );  
                $stylish_blog_query = new WP_Query($stylish_blog_args); 
                if ( $stylish_blog_query->have_posts() ) :  while ($stylish_blog_query->have_posts()) : $stylish_blog_query->the_post(); 
                ?>
                <?php if($stylish_blog_k == 1){ ?>
                  <div class="food-tab-boxes food-tab-box<?php echo esc_attr($stylish_blog_k); ?> overlay-post-box mb-3">
                    <div class="post-image-block-outer">
                      <div class="post-image-block">
                        <?php if(has_post_thumbnail()){ ?>
                        <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($stylish_blog_static_image).'">'); } ?>
                        <div class="news-inner">
                          <?php
                            if((get_theme_mod('stylish_blog_toggle_date', true) != 0) || (get_theme_mod('stylish_blog_toggle_auther', true) != 0) || (get_theme_mod('stylish_blog_toggle_comment', true) != 0)){ ?>
                            <div class="post-metabox">
                              <?php if(get_theme_mod('stylish_blog_toggle_auther',true) != 0){?>
                                <div class="post-author"><i class="fas fa-user"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></div>
                              <?php } ?>
                              <?php if(get_theme_mod('stylish_blog_toggle_date',true) != 0){?>
                                <div class="post-date"><i class="far fa-calendar-alt"></i><?php echo esc_html( get_the_date() ); ?></div>
                              <?php } ?>
                            </div>
                          <?php } ?>
                          <h4 class="p-0 royal"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                        </div>
                      </div>
                    </div>
                  </div>
                <?php } else { ?>
                  <div class="food-tab-boxes food-tab-box<?php echo esc_attr($stylish_blog_k); ?> mb-3" >
                    <div class="post-image-block-outer">
                      <div class="row">
                        <div class="post-image-block col-lg-3 col-sm-3 col-md-2 align-items-center"> 
                          <?php if(has_post_thumbnail()){ ?>
                          <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($stylish_blog_static_image).'">'); } ?>
                        </div>
                        <div class="col-lg-9 col-sm-9 col-md-10 tab-in-center align-items-center">
                          <div class="news-inner">
                            <?php
                              if((get_theme_mod('stylish_blog_toggle_date', true) != 0) || (get_theme_mod('stylish_blog_toggle_auther', true) != 0) || (get_theme_mod('stylish_blog_toggle_comment', true) != 0)){ ?>
                              <div class="post-metabox">
                                <?php if(get_theme_mod('stylish_blog_toggle_auther',true) != 0){?>
                                  <div class="post-author"><i class="fas fa-user"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></div>
                                <?php } ?>
                                <?php if(get_theme_mod('stylish_blog_toggle_date',true) != 0){?>
                                  <div class="post-date"><i class="far fa-calendar-alt"></i><?php echo esc_html( get_the_date() ); ?></div>
                                <?php } ?>
                              </div>
                            <?php } ?>
                            <h5 class="p-0"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                <?php } ?>
              <?php $stylish_blog_k++; endwhile; endif; ?>
            </div>
            <div class="col-lg-4 col-md-12 education-middle-box">
              <?php
              $stylish_blog_k = 1;
                $stylish_blog_args = array(
                  'post_type' => 'post',
                  'post_status' => 'publish',
                  'category_name' => get_theme_mod('stylish_blog_entertainment_tab_category_two'.$i),
                  'order' => 'ASC'
                );  
                $stylish_blog_query = new WP_Query($stylish_blog_args); 
                if ( $stylish_blog_query->have_posts() ) :  while ($stylish_blog_query->have_posts()) : $stylish_blog_query->the_post(); 
                ?>
                <?php if($stylish_blog_k == 1){ ?>
                  <div class="food-tab-boxes food-tab-box<?php echo esc_attr($stylish_blog_k); ?> overlay-post-box mb-3">
                    <div class="post-image-block-outer">
                      <div class="post-image-block">
                        <?php if(has_post_thumbnail()){ ?>
                        <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($stylish_blog_static_image).'">'); } ?>
                        <div class="news-inner">
                          <?php
                            if((get_theme_mod('stylish_blog_toggle_date', true) != 0) || (get_theme_mod('stylish_blog_toggle_auther', true) != 0) || (get_theme_mod('stylish_blog_toggle_comment', true) != 0)){ ?>
                            <div class="post-metabox">
                              <?php if(get_theme_mod('stylish_blog_toggle_auther',true) != 0){?>
                                <div class="post-author"><i class="fas fa-user"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></div>
                              <?php } ?>
                              <?php if(get_theme_mod('stylish_blog_toggle_date',true) != 0){?>
                                <div class="post-date"><i class="far fa-calendar-alt"></i><?php echo esc_html( get_the_date() ); ?></div>
                              <?php } ?>
                            </div>
                          <?php } ?>
                          <h5 class="p-0 royal"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                        </div>
                      </div>
                    </div>
                  </div>
                <?php } else { ?>
                  <div class="food-tab-boxes food-tab-box<?php echo esc_attr($stylish_blog_k); ?> mb-3">
                    <div class="post-image-block-outer">
                      <div class="row">
                        <div class="post-image-block col-lg-3 col-md-2 col-sm-3  pe-md-0 d-flex align-items-center"> 
                          <?php if(has_post_thumbnail()){ ?>
                          <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($stylish_blog_static_image).'">'); } ?>
                        </div>
                        <div class="col-lg-9 col-md-10  col-sm-9 tab-in-center">
                          <div class="news-inner">
                            <?php
                              if((get_theme_mod('stylish_blog_toggle_date', true) != 0) || (get_theme_mod('stylish_blog_toggle_auther', true) != 0) || (get_theme_mod('stylish_blog_toggle_comment', true) != 0)){ ?>
                              <div class="post-metabox">
                                <?php if(get_theme_mod('stylish_blog_toggle_auther',true) != 0){?>
                                  <div class="post-author"><i class="fas fa-user"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></div>
                                <?php } ?>
                                <?php if(get_theme_mod('stylish_blog_toggle_date',true) != 0){?>
                                  <div class="post-date"><i class="far fa-calendar-alt"></i><?php echo esc_html( get_the_date() ); ?></div>
                                <?php } ?>
                              </div>
                            <?php } ?>
                            <h5 class="p-0"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                <?php } ?>
              <?php $stylish_blog_k++; endwhile; endif; ?>
            </div>
            <div class="col-lg-4 col-md-12">
              <?php
              $stylish_blog_k = 1;
                $stylish_blog_args = array(
                  'post_type' => 'post',
                  'post_status' => 'publish',
                  'category_name' => get_theme_mod('stylish_blog_entertainment_tab_category_three'.$i),
                  'order' => 'ASC'
                );  
                $stylish_blog_query = new WP_Query($stylish_blog_args); 
                if ( $stylish_blog_query->have_posts() ) :  while ($stylish_blog_query->have_posts()) : $stylish_blog_query->the_post(); 
                ?>
                <div class="food-tab-boxes food-tab-box<?php echo esc_attr($stylish_blog_k); ?> mb-3">
                  <div class="post-image-block-outer">
                    <div class="row">
                      <div class="post-image-block col-lg-3 col-md-2 col-sm-3 pe-md-0 d-flex align-items-center"> 
                        <?php if(has_post_thumbnail()){ ?>
                        <img src="<?php the_post_thumbnail_url('full'); ?>"/> <?php }else {echo ('<img src="'. esc_url($stylish_blog_static_image).'">'); } ?>
                      </div>
                      <div class="col-lg-9 col-md-10 col-sm-9 tab-in-center">
                        <div class="news-inner">
                          <?php
                            if((get_theme_mod('stylish_blog_toggle_date', true) != 0) || (get_theme_mod('stylish_blog_toggle_auther', true) != 0) || (get_theme_mod('stylish_blog_toggle_comment', true) != 0)){ ?>
                            <div class="post-metabox">
                              <?php if(get_theme_mod('stylish_blog_toggle_auther',true) != 0){?>
                                <div class="post-author"><i class="fas fa-user"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php the_author(); ?></a></div>
                              <?php } ?>
                              <?php if(get_theme_mod('stylish_blog_toggle_date',true) != 0){?>
                                <div class="post-date"><i class="far fa-calendar-alt"></i><?php echo esc_html( get_the_date() ); ?></div>
                              <?php } ?>
                            </div>
                          <?php } ?>
                          <h5 class="p-0"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              <?php $stylish_blog_k++; endwhile; endif; ?>
            </div>
          </div>
        </div>
      <?php } ?>
    </div>
  </div>
</section>

<?php }?>
