<?php
/**
 * Home Section 1 Template
 *
 * @package Logistics Express
 */

// All section-specific code goes here...

$subsection_title = get_theme_mod('logistics_express_section1_subtitle', 'Explore Our Insights: Expert Healthcare Services Tailored for You');

$logistics_express_section_one = get_theme_mod( 'logistics_express_section1_enable' );
if ( 'Disable' == $logistics_express_section_one ) {
  return;
} ?>

<section id="section1" class="featured-posts">
  <div class="container-fluid">
    <div class="section-heading-main">
      <?php if(get_theme_mod('logistics_express_section1_title',true) != ''){?>
        <h2 class="section-title"><?php echo esc_html(get_theme_mod('logistics_express_section1_title')); ?></h2>
      <?php } ?>
      <p class="section-subtitle mb-6"><?php echo esc_html($subsection_title); ?></p>
    </div>
    <div class="row">
      <?php
        $args = array(
          'category_name' => get_theme_mod('logistics_express_section1_category'),
          'posts_per_page' => get_theme_mod('logistics_express_section1_category_number_of_posts_setting'),
          'order' => 'DESC'
        );
        $query = new WP_Query( $args );

        while ( $query->have_posts() ) : $query->the_post();
      ?>
      <div class="col-lg-6 col-md-12">
        <div class="post-box-section d-flex align-items-center">
          <?php if ( has_post_thumbnail() ) : ?>
          <div class="post-thumbnail">
            <a href="<?php the_permalink(); ?>">
              <?php the_post_thumbnail('medium_large', array('class' => 'animated-thumbnail')); ?>
            </a>
          </div>
          <?php endif; ?>
          <div class="data-inner">
            <?php if ( get_theme_mod( 'logistics_express_post_meta_toggle_switch_control', true ) ) : ?>
            <div class="sec2-meta">
              <span><?php echo esc_html(get_the_date()); ?></span>
              <span class="separator">|</span>
              <span><?php echo esc_html( get_the_author() ); ?></span>
            </div>
            <?php endif; ?>
            <h2 class="post-title">
              <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </h2>
            <div class="theme-btn">
              <a href="<?php the_permalink(); ?>">Read More</a>
            </div>
          </div>
        </div>
      </div>
      <?php endwhile; wp_reset_postdata(); ?>
    </div>
  </div>
</section>

