home_page.php 3.97 KB
<?php
/*
 * Template Name: Home Page
 */

get_header("home");

$product_sub_text = get_field('product_sub_text', $post->ID, true);
$header_part_image_mobile = get_field('mobile_header_image');
$anncouncement = get_field('announcements');
?>

<div id="homecontent" class="home-content">

   <?php if(!empty($anncouncement)) { ?>
      <!-- Change cookie name for new banner -->
      <div id="COVID-19-home-info-bar" class="hide"><button class="closeHomeBanner" type="button">x</button>
      <?= $anncouncement ?></div>
   <?php } ?>

   <div id="carousel-cont">
      <div id="carousel" class="carousel slide" data-ride="carousel" data-type="multi">
         <div class="carousel-inner">

               <div class="carousel-col">

                  <div class="head-image"><?= get_the_post_thumbnail() ?></div>

                  <div class='header-image-mobile'>
                        <img src='<?= (!empty($header_part_image_mobile)) ? $header_part_image_mobile['sizes']['large'] : "" ?>'  alt="home-page"/>
                  </div>

               </div>


         </div>
         <!-- <div class="left carousel-control" >
            <a href="#carousel" role="button" data-slide="prev">
               <span class="glyphicon prev-custom-control" aria-hidden="true"></span>
               <span class="sr-only">Previous</span>
            </a>
         </div>
         <div class="right carousel-control" >
            <a href="#carousel" role="button" data-slide="next">
               <span class="glyphicon custom-control" aria-hidden="true"></span>
               <span class="sr-only">Next</span>
            </a>
         </div> -->
      </div>
   </div>
<!-- 
   <div id="carouselButtons" style="display:none">
      <button id="playButton" type="button" class="btn btn-default btn-xs">
         <span class="glyphicon glyphicon-play"></span>
      </button>
      <button id="pauseButton" type="button" class="btn btn-default btn-xs">
         <span class="glyphicon glyphicon-pause"></span>
      </button>
   </div> -->
   <div class="header_tag_line"><?= get_the_content() ?></div>
   <div class="hr"></div>
   <div class="body-padding">
      <div class="row product-row">
         <h1 style='text-align:center'>PROTECT ALL YOU OWN</h1>
         <p><?php echo $product_sub_text; ?></p>
      </div>
      <div class="row">
         <?php
            if (function_exists(clean_home_custom_menus())) {
               clean_home_custom_menus();
            }
            ?>
      </div>
   </div>
   
   <div class="hr"></div>
   
   <?= get_field('care_to_grow') ?>

   <?= do_shortcode('[care-to-grow]') ?>

</div>



<script>
   jQuery(function($) {

      $('#carousel').carousel({
         interval: false,
         pause: "false",
      });

      $('#playButton').click(function() {
         $('#carousel').carousel('cycle');
      });
      $('#pauseButton').click(function() {
         $('#carousel').carousel('pause');
      });

      setTimeout(function() {

         $('#carouselButtons').hide();
         $('#pauseButton').click();
         if ($(window).width() < 768) {
            $("#carousel").swiperight(function() {
               $(this).carousel('prev');
            });
            $("#carousel").swipeleft(function() {
               $(this).carousel('next');
            });
         };
         if ($(window).width() > 1350) {
            // $('#pauseButton').click();
            //  console.log('pause');
            // $('#carouselButtons').hide();
            $('.carousel-control a').attr('tabindex', '-1');
         } else {
            //  console.log('play');
            //  $('#playButton').click();
            //  $('#carouselButtons').show();
            $('.carousel-control a').attr('tabindex', '0');
         };


      }, 1000);



      $('.head-image').attr('tabindex', '0');

   });
</script>

<?php wp_reset_query();?>
<style>
   .home-page-link {
      display: inline-block !important;
   }

   .broker-footer-login {
      display: none !important;
   }
</style>

</div>

<?php get_footer();?>