<?php

/**
 * Template Name: Custom Home Page
 */

get_header();

?>
<main id="maincontent" role="main">
<?php 
  $courier_services_number = get_theme_mod('courier_services_slide_number');
  if($courier_services_number != ''){
?>
  <?php if( get_theme_mod( 'courier_services_slider_hide_show', true) == 1 || get_theme_mod( 'courier_services_resp_slider_hide_show', true) == 1) { ?>
    <section id="slider" class="position-relative">
      <div id="carouselExampleIndicators" class="carousel slide <?php if ( get_theme_mod('courier_services_slide_remove_fade',true) == 1 ) { ?> carousel-fade <?php } ?>" data-bs-ride="carousel" data-type="multi" data-interval="false">
        <div class="carousel-inner" role="listbox">
          <?php for ($courier_services_i=1; $courier_services_i<=$courier_services_number; $courier_services_i++) {?>
            <div <?php if($courier_services_i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
              <?php if ( get_theme_mod('courier_services_banner_background_image_sec',true) != "" ) {?>
                <img class="slider-banner-img" src="<?php echo esc_url(get_theme_mod('courier_services_banner_background_image_sec'.$courier_services_i)); ?>" alt="<?php echo esc_attr(get_theme_mod('courier_services_slide_title'.$courier_services_i, true)); ?>" title="#slidecaption<?php echo esc_html($courier_services_i); ?>">
                <?php } ?>
                <div class="container">
                  <div class="carousel-caption">
                    <div class="inner_carousel">
                      <?php if(get_theme_mod('courier_services_designation_small_text'.$courier_services_i) != ''){ ?>
                        <span class="slider-small-text"><?php echo esc_html(get_theme_mod('courier_services_designation_small_text'.$courier_services_i)); ?></span>
                      <?php } ?>
                      <?php if(get_theme_mod('courier_services_tagline_title'.$courier_services_i) != ''){ ?>
                        <h2 class="slide_splice" class=""><?php echo esc_html(get_theme_mod('courier_services_tagline_title'.$courier_services_i)); ?></h2>
                      <?php } ?>
                       <?php if(get_theme_mod('courier_services_designation_text'.$courier_services_i) != ''){ ?>
                        <p class="slide_desc"><?php echo esc_html(get_theme_mod('courier_services_designation_text'.$courier_services_i)); ?></p>
                      <?php } ?>
                      <div class="d-flex gap-4 justify-content-lg-start justify-content-md-start justify-content-center">
                        <?php if ( get_theme_mod('courier_services_slider_button_label1'.$courier_services_i,'READ MORE') != '' ) {?>
                          <div class ="slider-btn1">
                            <a href="<?php echo esc_url(get_theme_mod('courier_services_slider_button_url1'.$courier_services_i,false));?>"><?php echo esc_html(get_theme_mod('courier_services_slider_button_label1'.$courier_services_i,'READ MORE'));?><span class="screen-reader-text"><?php esc_html_e( 'READ MORE','courier-services');?></span></a>
                          </div>
                        <?php }?>
                      </div>
                    </div>
                  </div>
                </div>
            </div>
          <?php } ?>
        </div>
          <div class="container-slider">
            <div class=" slider-indicator carousel-indicators text-center carousel slide"  class="carousel slide" data-bs-ride="carousel">
               <?php if ( get_theme_mod('courier_services_slider_dots',true) == "1" ){
                for ($courier_services_i=1;$courier_services_i<=$courier_services_number; $courier_services_i++) { ?>
                    <button type="button"
                      data-bs-target="#carouselExampleIndicators"
                      data-bs-slide-to="<?php echo esc_html($courier_services_i-1); ?>"
                      <?php if ($courier_services_i == 1) { echo 'class="indicator active"'; } ?> >
                        <span class="count">0<?php echo (esc_html($courier_services_i)); ?></span>
                   </button>
               <?php } }?>
            </div>
          </div>
      </div>
      <div class="clearfix"></div>
    </section>
       <div class="container form-sec-slider p-0">
        <?php if(get_theme_mod( 'courier_services_banner_form_shortcode') !='') { ?>
            <?php echo do_shortcode(get_theme_mod('courier_services_banner_form_shortcode')); ?>
        <?php }?> 
      </div>
  <?php }}?>
<?php do_action('courier_services_after_slider'); ?>


<!-- service Section -->
<?php if( get_theme_mod('courier_services_about_section',true) != ''){ ?>
  <section id="service-sec" class=" pt-5">
    <div class="container">
      <div class="service-setting text-center">
        <?php if(get_theme_mod('courier_services_section_title') != ''){ ?>
          <p class="service-small-heading"><?php echo esc_html(get_theme_mod('courier_services_section_title')) ?></p>
        <?php }?>
        <?php if(get_theme_mod('courier_services_feature_courses_tagline_title') != '') {?>
          <h3 class="service-heading"><?php echo esc_html(get_theme_mod('courier_services_feature_courses_tagline_title')) ?></h3>
          <img src="<?php echo esc_url(get_template_directory_uri()) ?>/assets/images/border-img.png" alt="">
        <?php }?>
      </div>
        <div class="owl-carousel">
            <?php
              $courier_services_featured_post = get_theme_mod('courier_services_claases_number');
            for ($courier_services_i=1; $courier_services_i <= $courier_services_featured_post; $courier_services_i++) {
              $courier_services_postData=  get_theme_mod('courier_services_services_category'.$courier_services_i);
              if($courier_services_postData){ ?>
                <div class="feature-box1 pt-5">
                  <?php
                    $args = array(
                      'p' => esc_html($courier_services_postData ,'courier-services'),
                      'posts_per_page' => 1,
                      'post_type' => 'post'
                    );
                    $query = new WP_Query( $args );
                    if ( $query->have_posts() ) :
                      while ( $query->have_posts() ) : $query->the_post(); ?>
                        <div class="classes-inner-box">
                         <?php if(has_post_thumbnail()){ ?>
                            <?php the_post_thumbnail(); ?>
                          <?php } else {?>
                            <img src="<?php echo esc_url(get_template_directory_uri()) ?>/assets/images/post-image.png" alt="<?php echo esc_attr('Post Image', 'courier-services'); ?>">
                          <?php }?>
                        </div>
                        <div class="icon-post-heading">
                          <div class="icon text-center text-sm-center text-md-start text-lg-start"><a href="<?php the_permalink(); ?>"><i class="<?php echo esc_attr(get_theme_mod('courier_services_single_icon'.$courier_services_i,'fa-solid fa-truck-fast')); ?>"></i></a>
                          </div>
                          <div class="post-innter-content class-box-content">
                            <h4 class="mt-3 "><a href="<?php the_permalink(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h4>
                          </div>
                         </div>
                      <?php endwhile;
                        wp_reset_postdata();
                    endif; ?>
                  </div>
              <?php }
            } ?>
        </div>
    </div>
  </section>
<?php }?>
<?php do_action( 'courier_services_after_service' ); ?>

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

<?php get_footer(); ?>