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

get_header(); ?>

<main id="skip-content">
  <?php if (get_theme_mod('ambulance_paramedics_banner_section_setting', false) != '') { ?>
    <section id="top-banner">
      <div class="banner-box">
        <div class="row mx-0">
          <div class="col-lg-5 col-md-6 align-self-center">
            <div class="banner-inner-box">
              <?php if(get_theme_mod('ambulance_paramedics_banner_heading') != ''){ ?>
                <h2 class=""><?php echo esc_html(get_theme_mod('ambulance_paramedics_banner_heading')); ?></h2>
              <?php }?>
              <div class="slide-btn mt-xl-5 mt-lg-4 mt-4">
                <?php if(get_theme_mod('ambulance_paramedics_banner_button_text1') != '' || get_theme_mod('ambulance_paramedics_banner_button_url1') != ''){ ?>
                  <a href="<?php echo esc_url(get_theme_mod('ambulance_paramedics_banner_button_url1')); ?>" class="banner-btn1 me-3"><?php echo esc_html(get_theme_mod('ambulance_paramedics_banner_button_text1')); ?></a>
                <?php }?>
                <?php if(get_theme_mod('ambulance_paramedics_banner_button_text2') != '' || get_theme_mod('ambulance_paramedics_banner_button_url2') != ''){ ?>
                  <a href="<?php echo esc_url(get_theme_mod('ambulance_paramedics_banner_button_url2')); ?>" class="banner-btn2"><?php echo esc_html(get_theme_mod('ambulance_paramedics_banner_button_text2')); ?></a>
                <?php }?>
              </div>
            </div>
          </div>
          <div class="col-lg-7 col-md-6 px-0">
            <div class="slider-image">
              <?php if(get_theme_mod('ambulance_paramedics_banner_image') != ''){ ?>
                <img src="<?php echo esc_url(get_theme_mod('ambulance_paramedics_banner_image')); ?>" alt="" />
              <?php } else{?>
                <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/img/banner-img.png" alt="" />
              <?php } ?>
            </div>
          </div>
        </div>
      </div>
    </section>
  <?php }?>

  <?php if (get_theme_mod('ambulance_paramedics_service_section_setting', false) != '') { ?>
    <section id="service-section" class="py-5">
      <div class="container">
        <div class="service-head mb-3 py-3">
          <div class="row">
            <div class="col-lg-9 col-md-9">
              <?php if(get_theme_mod('ambulance_paramedics_service_heading') != ''){ ?>
                <h3 class="main-heading text-md-start text-center"><?php echo esc_html(get_theme_mod('ambulance_paramedics_service_heading')); ?></h3>
              <?php }?>
              <?php if(get_theme_mod('ambulance_paramedics_service_content') != ''){ ?>
                <p class="text-md-start text-center"><?php echo esc_html(get_theme_mod('ambulance_paramedics_service_content')); ?></p>
              <?php }?>
            </div>
            <div class="col-lg-3 col-md-3">
              <?php if(get_theme_mod('ambulance_paramedics_service_btn_text') != '' || get_theme_mod('ambulance_paramedics_service_btn_url') != ''){?>
                <div class="service-btn text-center text-md-end text-center">
                  <a href="<?php echo esc_url(get_theme_mod('ambulance_paramedics_service_btn_url')); ?>"><?php echo esc_html(get_theme_mod('ambulance_paramedics_service_btn_text')); ?></a>
                </div>
              <?php }?>
            </div>
          </div>
        </div>
        <div class="row">
          <?php
            $ambulance_paramedics_service_category = get_theme_mod('ambulance_paramedics_service_category','');
            if($ambulance_paramedics_service_category){
              $ambulance_paramedics_page_query5 = new WP_Query(array( 'category_name' => esc_html($ambulance_paramedics_service_category,'ambulance-paramedics'), 'posts_per_page' => esc_attr(get_theme_mod('ambulance_paramedics_service_number',4))));
              $i=1;
              while( $ambulance_paramedics_page_query5->have_posts() ) : $ambulance_paramedics_page_query5->the_post(); ?>
                <div class="col-lg-3 col-md-6">
                  <div class="service-box">
                    <?php if(get_theme_mod('ambulance_paramedics_service_icon'.$i) != ''){ ?>
                      <div class="service-icon">
                        <i class="<?php echo esc_html(get_theme_mod('ambulance_paramedics_service_icon'.$i)); ?>"></i>
                      </div>
                    <?php }?>
                    <div class="service-content">
                      <h4><a href="<?php the_permalink(); ?>"><?php echo wp_trim_words(get_the_title(), 5, '...'); ?></a></h4>
                      <p class="mb-0"><?php echo esc_html( wp_trim_words( get_the_content(),10 )); ?></p>
                    </div>
                  </div>
                </div>
              <?php $i++; endwhile;
            wp_reset_postdata();
          } ?>
        </div>
      </div>
    </section>
  <?php }?>
  <section id="page-content">
    <div class="container">
      <div class="py-5">
        <?php
          if ( have_posts() ) :
            while ( have_posts() ) : the_post();
              the_content();
            endwhile;
          endif;
        ?>
      </div>
    </div>
  </section>
</main>

<?php get_footer(); ?>