<?php
/**
 * The template part for displaying slider
 *
 * @package Sauna Lite 
 * @subpackage sauna_lite
 * @since Sauna Lite 1.0
 */
?>
<?php 
  $sauna_lite_grid_columns = get_theme_mod('sauna_lite_grid_columns', '3');
  if ($sauna_lite_grid_columns == '3') {
    $sauna_lite_column_class = 'col-lg-4 col-md-4';
  } elseif ($sauna_lite_grid_columns == '4') {
    $sauna_lite_column_class = 'col-lg-3 col-md-6';
  } 
?>
<div class="<?php echo esc_attr($sauna_lite_column_class); ?>">
  <article id="post-<?php the_ID(); ?>" <?php post_class('inner-service'); ?>>
    <div class="grid-post-box">
      <div class="page-box mb-4">
        <div class="box-image">
          <?php if(has_post_thumbnail() && get_theme_mod( 'sauna_lite_grid_post_image_hide',true) != '') {
              the_post_thumbnail(); 
            }
          ?>
        </div>
        <div class="box-content p-3">
          <div class="tc-category">
            <?php the_category(); ?>
          </div>
          <h2 class="py-2 mb-2"><a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h2>
          <?php if( get_theme_mod( 'sauna_lite_grid_post_date_hide',true) != '' || get_theme_mod( 'sauna_lite_grid_post_comment_hide',true) != '' || get_theme_mod( 'sauna_lite_grid_post_author_hide',true) != '' || get_theme_mod( 'sauna_lite_grid_post_time_hide',true) != '') { ?>
              <?php if( get_theme_mod( 'sauna_lite_grid_post_date_hide',true) != '') { ?>
                <span class="entry-date me-2"><i class="<?php echo esc_attr(get_theme_mod('sauna_lite_grid_post_date_icon', 'far fa-calendar-alt me-1')); ?>"></i><?php echo esc_html( get_the_date() ); ?></span>
              <?php } ?>
              <?php if( get_theme_mod( 'sauna_lite_grid_post_author_hide',true) != '') { ?>
                <span class="entry-author me-2"><i class="<?php echo esc_attr(get_theme_mod('sauna_lite_grid_post_author_icon', 'fas fa-user me-1')); ?>"></i><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' )) ); ?>"><?php the_author(); ?><span class="screen-reader-text"><?php the_author(); ?></span></a></span>
              <?php } ?>

              <?php if( get_theme_mod( 'sauna_lite_grid_post_comment_hide',true) != '') { ?>
                <span class="entry-comments me-2"><i class="<?php echo esc_attr(get_theme_mod('sauna_lite_grid_post_comment_icon', 'fas fa-comments me-1')); ?>"></i><?php comments_number( __('0 Comments','sauna-lite'), __('0 Comments','sauna-lite'), __('% Comments','sauna-lite') ); ?></span>
              <?php } ?>

              <?php if( get_theme_mod( 'sauna_lite_grid_post_time_hide',true) != '') { ?>
                <span class="entry-time"><i class="<?php echo esc_attr(get_theme_mod('sauna_lite_grid_post_time_icon', 'fas fa-clock me-1')); ?>"></i><?php echo esc_html( get_the_time() ); ?></span>
              <?php }?>    
          <?php } ?>
          <?php if(get_theme_mod('sauna_lite_grid_post_content') == 'Full Content'){ ?>
            <?php the_content(); ?>
          <?php }
          if(get_theme_mod('sauna_lite_grid_post_content', 'Excerpt Content') == 'Excerpt Content'){ ?>
            <?php if(get_the_excerpt()) { ?>
              <p class="mb-2"><?php $sauna_lite_excerpt = get_the_excerpt(); echo esc_html( sauna_lite_string_limit_words( $sauna_lite_excerpt, esc_attr(get_theme_mod('sauna_lite_grid_post_excerpt_length','20')))); ?><?php echo esc_html( get_theme_mod('sauna_lite_grid_post_button_excerpt_suffix','[...]') ); ?></p>
            <?php }?>
          <?php }?>
          <?php if ( get_theme_mod('sauna_lite_post_button_text','Read More...') != '' ) {?>
            <a class="r_button hvr-sweep-to-right read-more"  href="<?php echo esc_url( get_permalink() ); ?>"><?php echo esc_html( get_theme_mod('sauna_lite_post_button_text',__( 'Read More...','sauna-lite' )) ); ?><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('sauna_lite_post_button_text',__( 'Read More...','sauna-lite' )) ); ?></span></a>
          <?php }?>
        </div>
        <div class="clearfix"></div>      
      </div>
    </div>
  </article>
</div>