<?php
/**
 * Template Name: Custom Home Page
 */
get_header(); ?>

<main id="content">
  <?php if( get_option('air_conditioning_services_slider_arrows', false) !== 'off'){ ?>
    <section id="slider">
      <div class="owl-carousel">
        <?php
          $air_conditioning_services_slider_category=  get_theme_mod('air_conditioning_services_post_setting');if($air_conditioning_services_slider_category){
          $air_conditioning_services_page_query = new WP_Query(array( 

            'category_name' => esc_html($air_conditioning_services_slider_category ,'air-conditioning-services'),

            'posts_per_page' => get_theme_mod('air_conditioning_services_slider_count')

          ));?>
            <?php while( $air_conditioning_services_page_query->have_posts() ) : $air_conditioning_services_page_query->the_post(); ?>
            <div class="slide-box">
              <div class="row">
                 <div class="col-lg-6 col-md-6 col-12 px-lg-0 px-md-0  px-sm-0 slide-content">
                  <div class="slide-inner-box slider-inner">
                    <?php if( get_theme_mod('air_conditioning_services_slide_heading') != ''){ ?>
                      <h3><?php echo esc_html(get_theme_mod('air_conditioning_services_slide_heading','')); ?></h3>
                    <?php }?>
                    <h2 class="slider-title mb-3"><?php the_title();?></h2>
                    <?php if( get_option('air_conditioning_services_slider_excerpt_show_hide',false) != 'off' ){ ?>
                      <p class="slider-excerpt mb-3"><?php echo wp_trim_words(get_the_content(), get_theme_mod('air_conditioning_services_slider_excerpt_count',22) );?></p>
                    <?php } ?>
                    <div class="home-btn my-lg-5 my-3">
                      <a class="py-md-3 px-md-4 py-2 px-3" href="<?php the_permalink(); ?>"><?php echo esc_html(get_theme_mod('air_conditioning_services_slider_read_more',__('Discover More','air-conditioning-services'))); ?></a>
                    </div>
                  </div>
                </div>
                <div class="col-lg-6 col-md-6 col-12 px-lg-0 px-md-0 px-sm-0 image-content">
                  <?php if(has_post_thumbnail()){ ?>
                    <img src="<?php the_post_thumbnail_url('full'); ?>"/>
                  <?php }else{?>
                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/slider.png" alt="" />
                  <?php } ?>
                </div>
              </div>
            </div>
            <?php endwhile;
          wp_reset_postdata();
        }?>
      </div>
    </section>
  <?php }?>
  <?php if( get_option('air_conditioning_services_about_enable', false) !== 'off'){ ?>
    <section id="home-about" class="py-5">
      <div class="container">
        <div class="row">
          <?php
            $air_conditioning_services_mod =  get_theme_mod( 'air_conditioning_services_about_us_settigs');
            if ( 'page-none-selected' != $air_conditioning_services_mod ) {
              $air_conditioning_services_about_page[] = $air_conditioning_services_mod;
            }
            if( !empty($air_conditioning_services_about_page) ) :
            $air_conditioning_services_args = array(
              'post_type' =>array('page'),
              'post__in' => $air_conditioning_services_about_page
            );
            $air_conditioning_services_query = new WP_Query( $air_conditioning_services_args );
            if ( $air_conditioning_services_query->have_posts() ) :
          ?>
          <?php while ( $air_conditioning_services_query->have_posts() ) : $air_conditioning_services_query->the_post(); ?>
            <div class="col-lg-6 col-md-6 col-12 column1 align-self-center">
                <div class="abt-image wow zoomIn">
                  <?php if(has_post_thumbnail()){ ?>
                    <?php the_post_thumbnail(); ?>
                  <?php }else{?>
                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/about.jpg" alt="" />
                  <?php } ?>
                  <?php if( get_theme_mod('air_conditioning_services_about_icon') != '' || get_theme_mod('air_conditioning_services_box_text') != ''|| get_theme_mod('air_conditioning_services_box_heading') != ''){ ?>
                    <div class="abt-box mx-auto text-center">
                      <i class="<?php echo esc_attr(get_theme_mod('air_conditioning_services_about_icon')); ?>"></i>
                      <?php if( get_theme_mod('air_conditioning_services_box_heading') != '' ){ ?>
                        <h5><?php echo esc_html( get_theme_mod('air_conditioning_services_box_heading')); ?></h5>
                      <?php }?>
                      <?php if( get_theme_mod('air_conditioning_services_box_text') != '' ){ ?>
                        <p class="mb-3"><?php echo wp_trim_words( get_theme_mod('air_conditioning_services_box_text'),15 );?></p>
                      <?php }?>
                    </div>
                  <?php } ?>
                </div>
            </div>
            <div class="col-lg-6 col-md-6 col-12  column2 align-self-center">
              <?php if( get_theme_mod('air_conditioning_services_services_heading') != ''){ ?>
                <h6><?php echo esc_html(get_theme_mod('air_conditioning_services_services_heading','')); ?></h6>
              <?php }?>
              <h4 class="mb-2"><?php the_title();?></h4>
              <p class="mb-3"><?php echo wp_trim_words( get_the_content(),20 );?></p>
              <div class="row icon-box">
                <?php if(get_theme_mod('air_conditioning_services_about_icon1_text') != ''|| get_theme_mod('air_conditioning_services_about_icon_1') != ''){ ?>
                  <div class="col-lg-6 col-md-6 col-6">
                    <div class="row">
                      <div class="col-lg-3 col-md-3 col-3">
                         <i class="<?php echo esc_attr(get_theme_mod('air_conditioning_services_about_icon_1')); ?>"></i>
                      </div>
                      <div class="col-lg-9 col-md-9 col-9">
                        <p class="mb-0"><?php echo esc_html(get_theme_mod('air_conditioning_services_about_icon1_text','')); ?></p>
                      </div>
                    </div>
                  </div>
                <?php }?>
                <?php if(get_theme_mod('air_conditioning_services_about_icon2_text') != '' || get_theme_mod('air_conditioning_services_about_icon_2') != ''){ ?>
                  <div class="col-lg-6 col-md-6 col-6">
                    <div class="row">
                      <div class="col-lg-3 col-md-3 col-3">
                        <i class="<?php echo esc_attr(get_theme_mod('air_conditioning_services_about_icon_2')); ?>"></i>
                      </div>
                      <div class="col-lg-9 col-md-9 col-9">
                        <p class="mb-0"><?php echo esc_html(get_theme_mod('air_conditioning_services_about_icon2_text','')); ?></p>
                      </div>
                    </div>
                  </div>
                <?php }?>
              </div>
              <div class="row">
                <div class="col-lg-6 col-md-6 col-6">
                  <?php if(get_theme_mod('air_conditioning_services_about_call_text') != ''|| get_theme_mod('air_conditioning_services_about_call_no') != ''){ ?>
                    <div class="contact-box text-center py-3  mt-2 py-md-2">
                      <?php if( get_theme_mod('air_conditioning_services_about_call_text') != '' ){ ?>
                        <h6 class="mb-0"><?php echo esc_html( get_theme_mod('air_conditioning_services_about_call_text')); ?></h6>
                      <?php }?>
                      <?php if( get_theme_mod('air_conditioning_services_about_call_no') != '' ){ ?>
                        <p class="mb-0"><?php echo esc_html( get_theme_mod('air_conditioning_services_about_call_no')); ?></p>
                      <?php }?>
                    </div>
                  <?php } ?>
                </div>
                <div class="col-lg-6 col-md-6 col-6">
                  <?php if( get_theme_mod('air_conditioning_services_about_text_3') != '' ){ ?>
                  <p class=" side-text my-2 py-1"><?php echo wp_trim_words( get_theme_mod('air_conditioning_services_about_text_3'),15 );?></p>
                  <?php }?>
                </div>
              </div>
              <div class="home-btn text-center text-sm-start my-4">
                <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','air-conditioning-services'); ?></a>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();?>
          <?php else : ?>
           <div class="no-postfound"></div>
            <?php endif;
          endif;?>
        </div>
      </div>
    </section>
  <?php }?>
  <section id="custom-page-content" <?php if ( have_posts() && trim( get_the_content() ) !== '' ) echo 'class="pt-3"'; ?>>
    <div class="container">
      <?php while ( have_posts() ) : the_post(); ?>
        <?php the_content(); ?>
      <?php endwhile; ?>
    </div>
  </section>
</main>

<?php get_footer(); ?>
