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

get_header(); ?>

<main id="maincontent" role="main">
  <?php do_action( 'law_firm_lite_before_slider' ); ?>

  <?php if( get_theme_mod( 'law_firm_lite_slider_arrows', true) == 1 || get_theme_mod( 'law_firm_lite_resp_slider_hide_show', true) == 1) { ?>
    <section id="slider"> 
      <?php if(get_theme_mod('law_firm_lite_slider_type', 'Default slider') == 'Default slider' ){ ?>
        <div id="carouselExampleCaptions" class="carousel slide" data-bs-ride="carousel" data-bs-interval="<?php echo esc_attr(get_theme_mod( 'law_firm_lite_slider_speed',4000)) ?>"> 
          <?php $law_firm_lite_pages = array();
            for ( $count = 1; $count <= 3; $count++ ) {
              $mod = intval( get_theme_mod( 'law_firm_lite_slider_page' . $count ));
              if ( 'page-none-selected' != $mod ) {
                $law_firm_lite_pages[] = $mod;
              }
            }
            if( !empty($law_firm_lite_pages) ) :
              $args = array(
                'post_type' => 'page',
                'post__in' => $law_firm_lite_pages,
                'orderby' => 'post__in'
              );
              $query = new WP_Query( $args );
              if ( $query->have_posts() ) :
                $i = 1;
          ?>     
          <div class="carousel-inner" role="listbox">
            <?php while ( $query->have_posts() ) : $query->the_post(); ?>
              <div <?php if($i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
                <?php if(has_post_thumbnail()){
                  the_post_thumbnail();
                } else{?>
                  <img src="<?php echo esc_url(get_template_directory_uri()); ?>/inc/block-patterns/images/banner.png" alt="" />
                <?php } ?>
                <div class="carousel-caption">
                  <div class="inner_carousel">
                    <h1 class="wow lightSpeedIn delay-1000" data-wow-duration="2s"><a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php echo the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
                    <p class="wow lightSpeedIn delay-1000" data-wow-duration="2s"><?php $law_firm_lite_excerpt = get_the_excerpt(); echo esc_html( law_firm_lite_string_limit_words( $law_firm_lite_excerpt, esc_attr(get_theme_mod('law_firm_lite_slider_excerpt_number','30')))); ?></p>
                    <?php if( get_theme_mod('law_firm_lite_slider_button_text','READ MORE') != ''){ ?>
                      <div class="more-btn wow lightSpeedIn delay-1000" data-wow-duration="2s">
                        <a href="<?php echo esc_url(get_theme_mod('law_firm_lite_topbar_btn_link','')); ?>"><i class="<?php echo esc_attr(get_theme_mod('law_firm_lite_slider_button_icon','fas fa-gavel')); ?>"></i><?php echo esc_html(get_theme_mod('law_firm_lite_slider_button_text',__('READ MORE','law-firm-lite')));?><span class="screen-reader-text"><?php echo esc_html(get_theme_mod('law_firm_lite_slider_button_text',__('READ MORE','law-firm-lite')));?></span></a>
                      </div>
                    <?php } ?>
                  </div>
                </div>
              </div>
            <?php $i++; endwhile; 
            wp_reset_postdata();?>
          </div>
          <?php else : ?>
              <div class="no-postfound"></div>
          <?php endif;
          endif;?>
          <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="fas fa-chevron-left"></i></span>
            <span class="screen-reader-text"><?php esc_html_e( 'Previous','law-firm-lite' );?></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="fas fa-chevron-right"></i></span>
            <span class="screen-reader-text"><?php esc_html_e( 'Next','law-firm-lite' );?></span>
          </a>
        </div>
        <div class="clearfix"></div>
        <?php } else if(get_theme_mod('law_firm_lite_slider_type', 'Advance slider') == 'Advance slider'){?>
          <?php echo do_shortcode(get_theme_mod('law_firm_lite_advance_slider_shortcode')); ?>
        <?php } ?>
    </section>
  <?php } ?>

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

  <section id="contact-sec" class="wow zoomInDown delay-1000" data-wow-duration="2s">
    <div class="container">
      <div class="row">
        <div class="col-lg-4 col-md-4 align-self-lg-center">
          <?php if( get_theme_mod( 'law_firm_lite_calling_text') != '' || get_theme_mod( 'law_firm_lite_calling_number') != '') { ?>
            <div class="con-box">
              <div class="row">
                <div class="col-lg-3 col-md-3 icon-center col-3">
                  <i class="<?php echo esc_attr(get_theme_mod('law_firm_lite_call_no_icon','fas fa-phone')); ?>"></i>
                </div>
                <div class="col-lg-9 col-md-9 p-lg-0 col-9">                
                  <p><?php echo esc_html(get_theme_mod('law_firm_lite_calling_text',''));?></p>
                  <h2><a href="tel:<?php echo esc_attr( get_theme_mod('law_firm_lite_calling_number','') ); ?>"><?php echo esc_html(get_theme_mod('law_firm_lite_calling_number',''));?></a></h2>
                </div>
              </div>
            </div>
          <?php }?>
        </div>
        <div class="col-lg-4 col-md-4 align-self-lg-center">
          <div class="social-icon">
            <?php if (is_active_sidebar('social-links')) : ?>
              <?php dynamic_sidebar('social-links'); ?>
            <?php else : ?>
              <!-- Default Social Icons Widgets -->
                <div class="widget">
                    <ul class="custom-social-icons" >
                      <li><a href="https://facebook.com" target="_blank"><i class="fab fa-facebook"></i></a></li> 
                      <li><a href="https://twitter.com" target="_blank"><i class="fab fa-twitter"></i></a></li> 
                      <li><a href="https://linkedin.com" target="_blank"><i class="fab fa-linkedin"></i></a></li> 
                      <li><a href="https://google.com" target="_blank"><i class="fab fa-google"></i></a></li>
                    </ul>
                </div>
            <?php endif; ?>   
          </div>
        </div>
        <div class="col-lg-4 col-md-4 align-self-lg-center">
          <?php if( get_theme_mod( 'law_firm_lite_email_text') != '' || get_theme_mod( 'law_firm_lite_email_address') != '') { ?>
            <div class="con-box">
              <div class="row">
                <div class="col-lg-3 col-md-3 col-3 icon-center">
                  <i class="<?php echo esc_attr(get_theme_mod('law_firm_lite_email_address_icon','far fa-envelope-open')); ?>"></i>
                </div>
                <div class="col-lg-9 col-md-9 col-9 p-lg-0">
                  <p><?php echo esc_html(get_theme_mod('law_firm_lite_email_text',''));?></p>
                  <h2><a href="mailto:<?php echo esc_attr(get_theme_mod('law_firm_lite_email_address',''));?>"><?php echo esc_html(get_theme_mod('law_firm_lite_email_address',''));?></a></h2>
                </div>
              </div>
            </div>
          <?php }?>
        </div>
      </div>
    </div>  
  </section>

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

  <section id="serv-section" class="wow slideInRight delay-1000" data-wow-duration="2s">
    <div class="container">
      <div class="heading-box">
        <?php if( get_theme_mod( 'law_firm_lite_section_text') != '') { ?>
          <p><?php echo esc_html(get_theme_mod('law_firm_lite_section_text',''));?></p>
        <?php } ?>
        <?php if( get_theme_mod( 'law_firm_lite_section_title') != '') { ?>
          <h3><?php echo esc_html(get_theme_mod('law_firm_lite_section_title',''));?></h3>  
        <?php } ?>
      </div>
      <div class="row">
        <?php
          $law_firm_lite_catData =  get_theme_mod('law_firm_lite_our_services','');
          if($law_firm_lite_catData){
          $page_query = new WP_Query(array( 'category_name' => esc_html($law_firm_lite_catData,'law-firm-lite'))); ?>
          <?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
          <div class="col-md-4 col-sm-6">
            <div class="box">
              <?php the_post_thumbnail(); ?>
              <div class="box-content">
                <h4 class="title"><?php the_title(); ?></h4>
                <p><?php $law_firm_lite_excerpt = get_the_excerpt(); echo esc_html( law_firm_lite_string_limit_words( $law_firm_lite_excerpt, esc_attr(get_theme_mod('law_firm_lite_practice_excerpt_number','10')))); ?></p>
                <?php if( get_theme_mod('law_firm_lite_practice_button_text','Consult Now') != ''){ ?>
                  <h6><a href="<?php echo esc_url(get_permalink()); ?>"><?php echo esc_html(get_theme_mod('law_firm_lite_practice_button_text',__('Consult Now','law-firm-lite')));?><i class="<?php echo esc_attr(get_theme_mod('law_firm_lite_our_practice_button_icon','fas fa-arrow-right')); ?>"></i><span class="screen-reader-text"><?php the_title(); ?></span></a></h6>
                <?php } ?>
              </div>
            </div>
          </div>
          <?php endwhile;
          wp_reset_postdata();
        } ?>
      </div>
    </div>
  </section>

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

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

<?php get_footer(); ?>
