<?php
/**
 * Template Name: Custom Home Page
 */

get_header(); 

?>

<main role="main" id="skip_content">

  <?php do_action( 'handyman_cleaner_above_slider' ); ?> 

  <?php if( get_theme_mod('handyman_cleaner_slider_hide', false) != '' || get_theme_mod( 'handyman_cleaner_display_slider',true) != ''){ ?>
    <section id="slider" class="mw-100 m-auto p-0">
      <div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel"> 
        <?php $handyman_cleaner_slider_page = array();
          for ( $handyman_cleaner_count = 1; $handyman_cleaner_count <= 4; $handyman_cleaner_count++ ) {
            $handyman_cleaner_mod = intval( get_theme_mod( 'handyman_cleaner_slider' . $handyman_cleaner_count ));
            if ( 'page-none-selected' != $handyman_cleaner_mod ) {
              $handyman_cleaner_slider_page[] = $handyman_cleaner_mod;
            }
          }
          if( !empty($handyman_cleaner_slider_page) ) :
          $handyman_cleaner_args = array(
            'post_type' => 'page',
            'post__in' => $handyman_cleaner_slider_page,
            'orderby' => 'post__in'
          );
          $handyman_cleaner_query = new WP_Query( $handyman_cleaner_args );
          if ( $handyman_cleaner_query->have_posts() ) :
            $i = 1;
        ?>     
          <div class="carousel-inner" role="listbox">
          <?php  while ( $handyman_cleaner_query->have_posts() ) : $handyman_cleaner_query->the_post(); ?>
            <div <?php if($i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
              <div class="slider-bg">
                <?php if(has_post_thumbnail()){
                  the_post_thumbnail();
                } else{?>
                  <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/slider.png" alt="<?php echo esc_attr( 'slider', 'handyman-cleaner'); ?>" />
                <?php } ?>
              </div>
              <div class="carousel-caption">
                <div class="inner_carousel">
                  <div class="carousel-content wow zoomIn data-wow-duration="4s>
                    <?php if( get_theme_mod('handyman_cleaner_slider_heading',true) != ''){ ?>
                      <h1><?php the_title(); ?></h1>
                    <?php } ?>
                    <?php if( get_theme_mod('handyman_cleaner_slider_text',true) != ''){ ?>
                      <p class="my-3"><?php $handyman_cleaner_excerpt = get_the_excerpt(); echo esc_html( handyman_cleaner_string_limit_words( $handyman_cleaner_excerpt, esc_attr(get_theme_mod('handyman_cleaner_slider_excerpt_number','20')))); ?></p>
                    <?php } ?>
                    <?php if( get_theme_mod('handyman_cleaner_show_slider_button',true) != ''){ ?>
                     <?php if( get_theme_mod('handyman_cleaner_slider_button_text','Learn More') != '' || get_theme_mod('handyman_cleaner_slider_button_link') != ''){ ?>
                        <div class="more-btn my-md-4 text-lg-start text-md-start text-center">
                          <a href="<?php echo esc_url(get_theme_mod('handyman_cleaner_slider_button_link')!= '') ? esc_url(get_theme_mod('handyman_cleaner_slider_button_link')) : esc_url(get_permalink()); ?>" class="p-3"><?php echo esc_html( get_theme_mod('handyman_cleaner_slider_button_text',__('Learn More','handyman-cleaner'))); ?><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('handyman_cleaner_slider_button_text',__('Learn More','handyman-cleaner'))); ?></span></a>
                        </div>
                      <?php }} ?>
                  </div>
                </div>
              </div>
            </div>
          <?php $i++; endwhile; 
          wp_reset_postdata();?>
          </div>
        <?php else : ?>
          <div class="no-postfound"></div>
        <?php endif;
        endif;?>
        <?php if( get_theme_mod('handyman_cleaner_slider_icon',false) != ''){ ?>
          <a class="carousel-control-prev" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev" role="button">
            <span class="carousel-control-prev-icon w-auto h-auto" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('handyman_cleaner_slider_previous_icon','fas fa-chevron-left')); ?>" ></i></span>
            <span class="screen-reader-text"><?php esc_html_e( 'Previous','handyman-cleaner' );?></span>
          </a>
          <a class="carousel-control-next" data-bs-target="#carouselExampleCaptions" data-bs-slide="next" role="button">
            <span class="carousel-control-next-icon w-auto h-auto" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('handyman_cleaner_slider_next_icon','fas fa-chevron-right')); ?>" ></i></span>
            <span class="screen-reader-text"><?php esc_html_e( 'Next','handyman-cleaner' );?></span>
          </a>
        <?php } ?>
      </div>  
      <div class="clearfix"></div>
    </section>
  <?php }?>
  
  <?php do_action( 'handyman_cleaner_below_slider' ); ?>

<!-- price section -->
<?php if( get_theme_mod( 'handyman_cleaner_price_section',false) != false) { ?>
    <section id="planning-section" class="py-5">
      <div class="container">
        <div class="row">        
            <div class="col-lg-7 col-md-12 col-12">
              <div class="row">
                <div class="col-lg-6 col-md-6 col-12"> 
                  <div class="price-plane p-4 mb-4 wow bounceInDown data-wow-delay=".25s>
                    <?php if( get_theme_mod('handyman_cleaner_regular_small_title') != '' ){ ?>
                      <h4 class="small-title"><?php echo esc_html(get_theme_mod('handyman_cleaner_regular_small_title'));?></h4>
                    <?php }?>
                    <?php if( get_theme_mod('handyman_cleaner_regular_price') != '' ){ ?>
                      <p class="card-price"><?php echo esc_html(get_theme_mod('handyman_cleaner_regular_price'));?></p>
                    <?php }?>
                    <?php for ($handyman_cleaner_k=1; $handyman_cleaner_k <= 4 ; $handyman_cleaner_k++) { ?>
                      <div class="col-lg-12 col-md-12 mb-3 align-self-center">
                        <i class="list-icon me-3 <?php echo esc_attr(get_theme_mod('handyman_cleaner_regular_about_list_icon'.$handyman_cleaner_k, 'fas fa-check')); ?>"></i> <span class="list mb-4"><?php echo esc_html(get_theme_mod('handyman_cleaner_regular_about_page_list'.$handyman_cleaner_k));?></span>
                      </div>
                    <?php }?>
                    <?php if( get_theme_mod('handyman_cleaner_show_regular_card_button',true) != ''){ ?>
                      <?php if( get_theme_mod('handyman_cleaner_regular_button_text','Order Cleaning') != '' || get_theme_mod('handyman_cleaner_regular_button_link') != ''){ ?>
                        <div class="card-btn">
                          <a href="<?php echo esc_url(get_theme_mod('handyman_cleaner_regular_button_link','')); ?>"><?php echo esc_html( get_theme_mod('handyman_cleaner_regular_button_text',__('Order Cleaning','handyman-cleaner'))); ?><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('handyman_cleaner_regular_button_text',__('Order Cleaning','handyman-cleaner'))); ?></span></a>
                        </div>
                      <?php } ?>
                    <?php }?>
                  </div>
                </div>
                <div class="col-lg-6 col-md-6 col-12">
                  <div class="price-plane p-4 mb-4 wow bounceInUp data-wow-delay=".25s>
                    <?php if( get_theme_mod('handyman_cleaner_small_title') != '' ){ ?>
                      <h4 class="small-title"><?php echo esc_html(get_theme_mod('handyman_cleaner_small_title'));?></h4>
                    <?php }?>
                    <?php if( get_theme_mod('handyman_cleaner_price') != '' ){ ?>
                      <p class="card-price"><?php echo esc_html(get_theme_mod('handyman_cleaner_price'));?></p>
                    <?php }?>
                    <?php for ($handyman_cleaner_i=1; $handyman_cleaner_i <= 4 ; $handyman_cleaner_i++) { ?>
                      <div class="col-lg-12 col-md-12 mb-3 align-self-center">
                        <i class="list-icon me-3 <?php echo esc_attr(get_theme_mod('handyman_cleaner_about_list_icon'.$handyman_cleaner_i, 'fas fa-check')); ?>"></i> <span class="list mb-4"><?php echo esc_html(get_theme_mod('handyman_cleaner_about_page_list'.$handyman_cleaner_i));?></span>
                      </div>
                    <?php }?>
                    <?php if( get_theme_mod('handyman_cleaner_show_card_button',true) != ''){ ?>
                      <?php if( get_theme_mod('handyman_cleaner_card_button_text','Order Cleaning') != '' || get_theme_mod('handyman_cleaner_button_link') != ''){ ?>
                        <div class="card-btn">
                          <a href="<?php echo esc_url(get_theme_mod('handyman_cleaner_button_link','')); ?>"><?php echo esc_html( get_theme_mod('handyman_cleaner_card_button_text',__('Order Cleaning','handyman-cleaner'))); ?><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('handyman_cleaner_card_button_text',__('Order Cleaning','handyman-cleaner'))); ?></span></a>
                        </div>
                      <?php } ?>
                    <?php }?>
                  </div>
                </div>
              </div>
            </div>
          <?php if( get_theme_mod( 'handyman_cleaner_show_pricing_section',false) != false) { ?>
            <div class="col-lg-5 col-md-12 col-12">
              <div class="price-page-box wow zoomInUp" role="listbox">
                <div class="price-page-content">
                  <?php if( get_theme_mod('handyman_cleaner_price_page_small_title') != '' ){ ?>
                    <p class="price-title mb-2"><?php echo esc_html(get_theme_mod('handyman_cleaner_price_page_small_title'));?></p>
                  <?php }?>
                  <?php if( get_theme_mod('handyman_cleaner_price_page_heading') != '' ){ ?>
                    <h2 class="price-heading"><?php echo esc_html(get_theme_mod('handyman_cleaner_price_page_heading'));?></h2>
                  <?php }?>
                  <?php if( get_theme_mod('handyman_cleaner_price_page_content') != '' ){ ?>
                    <p class="price-page-text mb-3"><?php echo esc_html(get_theme_mod('handyman_cleaner_price_page_content'));?></p>
                  <?php }?>
                  <?php for ($handyman_cleaner_j=1; $handyman_cleaner_j <= 4 ; $handyman_cleaner_j++) { ?>
                    <div class="col-lg-12 col-md-12 align-self-center d-flex">
                      <i class="list-icon me-3 <?php echo esc_attr(get_theme_mod('handyman_cleaner_regular_pricing_page_list_icon'.$handyman_cleaner_j, 'fas fa-chevron-right')); ?>"></i> <span class="list mb-4"><?php echo esc_html(get_theme_mod('handyman_cleaner_regular_pricing_page_text'.$handyman_cleaner_j));?></span>
                    </div>
                  <?php }?>
                </div>
              </div>
            </div>
          <?php }?>      
        </div>
      </div>
    </section>
<?php }?>

  <div class="container front-page-content">
    <?php while ( have_posts() ) : the_post(); ?>
      <div class="new-text"><?php the_content(); ?></div>
    <?php endwhile; // end of the loop. ?>
  </div>
</main>

<?php get_footer(); ?>