<?php
error_reporting(0);
/**
*The template for displaying Search Results pages.
*/
get_header(); ?>

<section class="banner-hero about-us-banner" style="background: url('./wp-content/uploads/2024/03/top-banner-2.png'); margin-top: -70px;">
   <div class="custom-container">
      <div class="banner-content">
            <h1><?php echo get_field('heading'); ?></h1>
            <nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
               <ol class="breadcrumb">
                  <li class="breadcrumb-item"><img src="<?php echo get_template_directory_uri(); ?>/assets/images/home.png" alt=""> <a href="<?php echo home_url(); ?>"> Home</a></li>
                  <li class="breadcrumb-item active" aria-current="page"><?php echo get_the_title(); ?></li>
               </ol>
            </nav>
      </div>
   </div>
</section>

<section class="">

   <?php if (have_posts()) :
      $count = 0;
      while (have_posts()) : the_post();
         $count++;
      endwhile;
   endif;
   if(empty($count)){ $count = 0; } ?>

   <div class="cntc-touch-form">
      <h5>Search</h5>
      <form role="search" method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" autocomplete="off">
         <div class="row">
            <div class="col-xl-6 col-md-6 col-sm-12">
               <input type="search" name="s" id="searchInput" class="form-control" onkeyup="fetchResults()" placeholder="Search here" value="<?php echo get_search_query(); ?>" required>
            </div>
            <div class="col-xl-2 col-md-2 col-sm-12 text-center">
               <input type="submit" class="globalBtnLight form-control" value="Search">
            </div>
         </div>
      </form>
      <p><strong><?php echo $count; ?></strong> results found</p>
   </div>

   <?php if (have_posts()) :
      while (have_posts()) : the_post();
   ?>

      <a href="<?php the_permalink(); ?>" class="">
         <section class="support-management">
            <div class="custom-container">
               <div class="support-management-item">
                  <div class="suport-manage-cntn">
                     <h5><?php the_title() ?></h5>
                     <p><?php the_excerpt(); ?></p>
                  </div>
               </div>
            </div>
         </section>
      </a>

   <?php endwhile;
      wp_reset_postdata();
   endif; ?>

</section>

<?php get_footer(); ?>