<?php 
$expert_digital_agency_servicesec = get_theme_mod('expert_digital_agency_service_show_hide', true);
$expert_digital_agency_servicesec_button = get_theme_mod('expert_digital_agency_serv_button_setting', '1');

if ($expert_digital_agency_servicesec == '1') :
?>
<section id="service-section" class="py-5">
  <div class="container"> 
    <?php if (get_theme_mod('expert_digital_agency_section_title') || get_theme_mod('expert_digital_agency_section_text')) : ?>
      <div class="serv-head text-start mb-5 position-relative"> 
        <?php if (get_theme_mod('expert_digital_agency_section_title')) : ?>
          <h2 class="text-uppercase mb-2"><?php echo esc_html(get_theme_mod('expert_digital_agency_section_title')); ?></h2>
        <?php endif; ?> 
        <?php if (get_theme_mod('expert_digital_agency_section_text')) : ?>
          <p><?php echo esc_html(get_theme_mod('expert_digital_agency_section_text')); ?></p>
        <?php endif; ?>
      </div>
    <?php endif; ?>
    <div class="row m-0">
      <?php
      $expert_digital_agency_post_category = get_theme_mod('expert_digital_agency_offer_section_category','uncategorized');
      if ($expert_digital_agency_post_category) :
        $expert_digital_agency_category_id = term_exists($expert_digital_agency_post_category, 'category');
        if ($expert_digital_agency_category_id !== 0 && $expert_digital_agency_category_id !== null) :
          $expert_digital_agency_page_query = new WP_Query(array('category_name' => esc_attr($expert_digital_agency_post_category)));
          if ($expert_digital_agency_page_query->have_posts()) :
            while ($expert_digital_agency_page_query->have_posts()) : $expert_digital_agency_page_query->the_post(); ?>
              <div class="col-lg-4 col-md-4 mb-5 wow fadeInUp" data-wow-delay="0.5s">
                <div class="inner-box-image">
                  <?php if (has_post_thumbnail()) : ?>
                    <img src="<?php echo esc_url(get_the_post_thumbnail_url(null, 'full')); ?>" />
                  <?php else : ?>
                    <div class="serv-color"></div>
                  <?php endif; ?>
                  <div class="inner-box text-start py-lg-3 py-2 px-lg-5 px-3">
                    <h3 class="position-relative ps-lg-5 ps-5 mb-4"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                    <p class="mb-2 serv-content"><?php echo esc_html(wp_trim_words(get_the_content(), '20')); ?></p>
                    <?php if ($expert_digital_agency_servicesec_button == '1') : ?>
                      <div class="read-btn mt-lg-3 mt-2">
                        <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More', 'expert-digital-agency'); ?><i class="ps-2 fas fa-arrow-right"></i></a>
                      </div>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            <?php endwhile; ?>
            <?php wp_reset_postdata(); ?>
          <?php else : ?>
            <div class="no-postfound"></div>
          <?php endif; ?>
        <?php endif; ?>
      <?php endif; ?>
    </div>
  </div>
</section>
<?php endif; ?>
