<?php if ( get_theme_mod('pest_control_lite_about_us_section_enable', true) == true ) : ?>

<?php $post_cat_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('pest_control_lite_about_category'),
  'posts_per_page' => get_theme_mod('pest_control_lite_about_category_number'),
); ?>

  <section id="about" class="pt-5">
    <div class="container">
      <div class="row">
        <?php $pest_control_lite_about_pages = array();
          $pest_control_lite_mod = intval( get_theme_mod( 'pest_control_lite_about_us' ));
          if ( 'page-none-selected' != $pest_control_lite_mod ) {
            $pest_control_lite_about_pages[] = $pest_control_lite_mod;
          }
          if( !empty($pest_control_lite_about_pages) ) :
            $pest_control_lite_args = array(
              'post_type' => 'page',
              'post__in' => $pest_control_lite_about_pages,
              'orderby' => 'post__in'
            );
            $pest_control_lite_query = new WP_Query( $pest_control_lite_args );
            if ( $pest_control_lite_query->have_posts() ) :
              $i = 1;
        ?>
        <?php  while ( $pest_control_lite_query->have_posts() ) : $pest_control_lite_query->the_post(); ?>
          <div class="col-lg-6 col-md-12 col-sm-12 align-self-center wow fadeInLeft">
            <div class="text-center text-md-start">
              <?php if ( get_theme_mod('pest_control_lite_about_us_section_title') ) : ?>
                <h3><?php echo esc_html(get_theme_mod('pest_control_lite_about_us_section_title')) ?></h3>
              <?php endif; ?>
              <h4 class="my-3"><?php the_title(); ?></h4>
              <?php echo wp_trim_words( get_the_content(), get_theme_mod('pest_control_lite_about_excerpt_number',60) ); ?>
              <p class="slider-button mt-4">
                <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('View More','pest-control-lite'); ?></a>
              </p>
            </div>
          </div>
        <?php $i++; endwhile; ?>
        <?php wp_reset_postdata(); else : ?>
          <div class="no-postfound"></div>
        <?php endif;
        endif;?>
        <div class="col-lg-6 col-md-12 col-sm-12 align-self-center wow fadeInRight">
          <?php $pest_control_lite_arr_posts = new WP_Query( $post_cat_args );
            if ( $pest_control_lite_arr_posts->have_posts() ) :
              $i=1;
              while ( $pest_control_lite_arr_posts->have_posts() ) :
                $pest_control_lite_arr_posts->the_post();
                ?>
                <div class="about-cat text-center text-md-start">
                  <div class="row">
                    <div class="col-lg-2 col-md-2 col-sm-2 align-self-center">
                      <h6 class="catno"><?php if($i <=9 ) { echo esc_html(0); } echo esc_html($i); ?></h6>
                    </div>
                    <div class="col-lg-10 col-md-10 col-sm-10 align-self-center">
                      <h5 class="my-3"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
                      <p class="slider-text"><?php echo wp_trim_words( get_the_content(), 15); ?><p>
                    </div>
                  </div>
                </div>
              <?php $i++;
            endwhile;
            wp_reset_postdata();
            endif; ?>
        </div>
      </div>
    </div>
  </section>

<?php endif; ?>
