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

get_header(); 

if( get_theme_mod('digital_agency_lite_second_color')){
    $digital_agency_lite_about_back1=get_theme_mod('digital_agency_lite_second_color');
  }else{
    $digital_agency_lite_about_back1="#f8d698";
  }
  if( get_theme_mod('digital_agency_lite_fourth_color')){
    $digital_agency_lite_about_back2=get_theme_mod('digital_agency_lite_fourth_color');
  }else{
    $digital_agency_lite_about_back2="#f5af78";
  }
?>

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

  <?php if( get_theme_mod( 'digital_agency_lite_slider_arrows', true) == 1 || get_theme_mod( 'digital_agency_lite_resp_slider_hide_show', true) == 1) { ?>
  <svg class="top_svg" viewBox="0 0 1920 972">
    <defs>
      <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
        <stop offset="0%" style="stop-color:<?php echo esc_html($digital_agency_lite_about_back1); ?>;stop-opacity:1"></stop>
        <stop offset="100%" style="stop-color:<?php echo esc_html($digital_agency_lite_about_back2); ?>;stop-opacity:1"></stop>
      </linearGradient>
    </defs>
    <path fill="url(#grad1)" d="M0,0H1920V2.5c-3.67,1.009-4.67,4.2-7,6.5-1.79,1.769-3.96,2.961-6,4.5-3.09,2.332-5.36,6.151-8.5,8.5-17.55,13.147-34.76,27.308-53.5,39-36.73,22.917-78.9,40.722-120,59-4.86,2.163-10.01,2.113-15,4-17.14,6.482-35.88,12.964-53.5,19-8.45,2.9-16.15,3.43-25,6-21.5,6.239-45.2,10.127-66.5,16l-9.5,1c-6.11,1.517-13.75,2.448-19.5,4l-12.5,1c-12.64,3.406-29.65,3.623-42.5,7h-8.5c-9.79,2.423-24.09,1.58-34,4h-10c-8.66,2.149-19.63,1.552-29,4-23.53,6.146-52.1,9.061-75.5,15-4.02,1.019-6.92-.043-11,1-21.89,5.59-45.57,10.694-67.5,17-14.22,4.088-28.3,5.313-42,10-11.5,3.936-23.83,8.209-35,12-6.01,2.04-11.7,1.878-17.5,4-24.58,9-50.69,17.648-74.5,28-9.63,4.188-19.84,5.453-29,10-23.17,11.5-48.922,19.962-72,32C915.452,346.322,856.169,377.9,803,416c-21.776,15.6-42.471,32.871-64,49-4.077,3.055-6.978,7.957-11,11-5.833,4.412-10.572,9.547-16.5,14-3.2,2.4-6.065,6.277-8.5,9.5l-7,6.5c-3.341,3.341-6.192,7.122-9.5,10.5l-28,27.5c-6.239,6.239-11.9,13.132-19,18.5l-11.5,12c-8.794,7.825-17.082,16.384-26.5,23.5l-10,10.5c-8.585,8.584-17.784,17.658-27.5,25l-9,9.5c-26.249,19.733-49.135,43.209-75.5,63-3.672,2.756-6.247,7.241-10,10-27.181,19.983-52.224,42.367-79.5,62-29.729,21.4-60.439,43.375-91.5,63-11.449,7.234-23.432,12.8-35,20-14.441,8.983-29.358,18.751-44.5,27-21.624,11.78-44.243,21.961-66.5,33-16.006,7.939-33.7,13.886-50,21-4.381,1.912-8.117,2.092-12.5,4-15.608,6.795-33.8,12.633-50.5,18L31,965c-9.79,2.807-18.593,6.8-31,7V0Z"></path>
  </svg>

  <section id="slider">
    <?php if(get_theme_mod('digital_agency_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( 'digital_agency_lite_slider_speed',4000)) ?>"> 
      <?php $digital_agency_lite_pages = array();
        for ( $count = 1; $count <= 3; $count++ ) {
          $mod = intval( get_theme_mod( 'digital_agency_lite_slider_page' . $count ));
          if ( 'page-none-selected' != $mod ) {
            $digital_agency_lite_pages[] = $mod;
          }
        }
        if( !empty($digital_agency_lite_pages) ) :
          $args = array(
            'post_type' => 'page',
            'post__in' => $digital_agency_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"';}?>>
            <div class="container">
              <div class="row">
                <div class="col-lg-7 col-md-7">
                  <div class="carousel-caption">
                    <h1 class="wow slideInDown delay-1000" data-wow-duration="3s"><a href="<?php echo esc_url( get_permalink() ); ?>" title="<?php echo the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
                    <?php if( get_theme_mod('digital_agency_lite_slider_content_hide_show',true) == 1){ ?>
                      <p class="wow slideInDown delay-1000" data-wow-duration="3s"><?php $digital_agency_lite_excerpt = get_the_excerpt(); echo esc_html( digital_agency_lite_string_limit_words( $digital_agency_lite_excerpt, esc_attr(get_theme_mod('digital_agency_lite_slider_excerpt_number','20')))); ?></p>
                    <?php } ?>
                    <?php if( get_theme_mod('digital_agency_lite_slider_button_text','READ MORE') != ''|| get_theme_mod('digital_agency_lite_slider_button_link') != ''){ ?>
                      <div class="more-btn wow slideInRight delay-1000" data-wow-duration="3s">
                        <a href="<?php echo esc_url(get_theme_mod('digital_agency_lite_slider_button_link','')); ?>"><?php echo esc_html(get_theme_mod('digital_agency_lite_slider_button_text',__('READ MORE','digital-agency-lite')));?><span class="screen-reader-text"><?php echo esc_html(get_theme_mod('digital_agency_lite_slider_button_text',__('READ MORE','digital-agency-lite')));?></span></a>
                      </div>
                    <?php } ?>
                  </div>
                </div>
                <div class="col-lg-5 col-md-5">
                  <div class="slider-img">
                    <?php if(has_post_thumbnail()){
                      the_post_thumbnail();
                    } else{?>
                      <img src="<?php echo esc_url(get_template_directory_uri()); ?>/inc/block-patterns/images/banner-circle.png" alt="" />
                    <?php } ?>
                  </div>
                </div>
              </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','digital-agency-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','digital-agency-lite' );?></span>
      </a>
    </div>
    <div class="clearfix"></div>
        <?php } else if(get_theme_mod('digital_agency_lite_slider_type', 'Advance slider') == 'Advance slider'){?>
          <?php echo do_shortcode(get_theme_mod('digital_agency_lite_advance_slider_shortcode')); ?>
        <?php } ?>
  </section>
  <?php } ?>

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

  <?php if( get_theme_mod('digital_agency_lite_services_category') != '' ){ ?>

  <section id="digital-services" class="wow zoomInDown delay-1000" data-wow-duration="1.5s">
    <div class="container">
      <div class="heading-text">
        <?php if( get_theme_mod( 'digital_agency_lite_section_title') != '') { ?>
          <h2><?php echo esc_html(get_theme_mod('digital_agency_lite_section_title',''));?></h2>
        <?php } ?>
        <?php if( get_theme_mod( 'digital_agency_lite_section_text') != '') { ?>
          <p class="sec-text"><?php echo esc_html(get_theme_mod('digital_agency_lite_section_text',''));?></p>
        <?php } ?>
      </div>
      <div class="row">
        <?php 
        $digital_agency_lite_catData=  get_theme_mod('digital_agency_lite_services_category');
          if($digital_agency_lite_catData){
            $page_query = new WP_Query(array( 'category_name' => esc_html( $digital_agency_lite_catData ,'digital-agency-lite')));?>
              <?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
                <div class="col-lg-4 col-md-4">
                  <div class="inner-box">
                    <?php the_post_thumbnail(); ?>
                    <h3><a href="<?php echo esc_url( get_permalink() );?>"><?php the_title();?><span class="screen-reader-text"><?php the_title(); ?></span></a></h3>
                    <p><?php $digital_agency_lite_excerpt = get_the_excerpt(); echo esc_html( digital_agency_lite_string_limit_words( $digital_agency_lite_excerpt, esc_attr(get_theme_mod('digital_agency_lite_services_excerpt_number','20')))); ?></p>
                  </div>
                </div>
              <?php endwhile;
            wp_reset_postdata();
          } ?>
      </div>
    </div>
  </section>

  <?php }?>

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

  <div id="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(); ?>