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

get_header(); ?>

<main id="skip-content">
  <?php if (get_theme_mod('event_dining_catering_banner_section_setting', false) != '') { ?>
    <section id="top-banner">
      <div class="banner-box">
        <div class="container">
          <div class="row">
            <div class="col-lg-6 col-md-6 align-self-center">
              <div class="banner-inner-box">
                <?php if(get_theme_mod('event_dining_catering_banner_heading') != ''){ ?>
                  <h2 class=""><?php echo esc_html(get_theme_mod('event_dining_catering_banner_heading')); ?></h2>
                <?php }?>
                <?php if(get_theme_mod('event_dining_catering_banner_content') != ''){ ?>
                  <p class=""><?php echo esc_html(get_theme_mod('event_dining_catering_banner_content')); ?></p>
                <?php }?>
                <div class="slide-btn mt-xl-5 mt-lg-4 mt-4">
                  <?php if(get_theme_mod('event_dining_catering_banner_button_text1') != '' || get_theme_mod('event_dining_catering_banner_button_url1') != ''){ ?>
                    <a href="<?php echo esc_url(get_theme_mod('event_dining_catering_banner_button_url1')); ?>" class="banner-btn1 me-3"><?php echo esc_html(get_theme_mod('event_dining_catering_banner_button_text1')); ?></a>
                  <?php }?>
                  <?php if(get_theme_mod('event_dining_catering_banner_button_text2') != '' || get_theme_mod('event_dining_catering_banner_button_url2') != ''){ ?>
                    <a href="<?php echo esc_url(get_theme_mod('event_dining_catering_banner_button_url2')); ?>" class="banner-btn2"><?php echo esc_html(get_theme_mod('event_dining_catering_banner_button_text2')); ?></a>
                  <?php }?>
                </div>
              </div>
            </div>
            <div class="col-lg-6 col-md-6 px-0 text-md-end">
              <div class="slider-image text-md-end text-center">
                <div class="banner-inner">
                  <div class="counter">
                    <?php for ($i=0; $i < 3; $i++) { ?>
                      <div class="counter-box">
                        <?php if(get_theme_mod('event_dining_catering_counter_number'.$i) != ''){?>
                          <span class="counter-number"><?php echo esc_html(get_theme_mod('event_dining_catering_counter_number'.$i)); ?></span>
                        <?php }?>
                        <?php if(get_theme_mod('event_dining_catering_counter_text'.$i) != ''){?>
                          <span class="counter-text"><?php echo esc_html(get_theme_mod('event_dining_catering_counter_text'.$i)); ?></span>
                        <?php }?>
                      </div>
                    <?php }?>
                  </div>
                  <?php if(get_theme_mod('event_dining_catering_banner_image') != ''){ ?>
                    <img src="<?php echo esc_url(get_theme_mod('event_dining_catering_banner_image')); ?>" class="banner-img" alt="" />
                  <?php } else{?>
                    <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/img/banner-img.png" class="banner-img" alt="" />
                  <?php } ?>
                </div>
                <?php if(get_theme_mod('event_dining_catering_review_image') != '' || get_theme_mod('event_dining_catering_banner_review_text') != '' || get_theme_mod('event_dining_catering_banner_review_rating') != ''){?>
                  <div class="review-box text-start">
                    <div class="row">
                      <div class="col-lg-4 col-md-4 col-4 align-self-center">
                        <?php if(get_theme_mod('event_dining_catering_review_image') != ''){ ?>
                          <img src="<?php echo esc_url(get_theme_mod('event_dining_catering_review_image')); ?>" alt="" />
                        <?php }?>
                      </div>
                      <div class="col-lg-8 col-md-8 col-8 align-self-center ps-0">
                        <?php if(get_theme_mod('event_dining_catering_banner_review_text') != '') {?>
                          <h6><?php echo esc_html(get_theme_mod('event_dining_catering_banner_review_text')); ?></h6>
                        <?php }?>
                        <?php if(get_theme_mod('event_dining_catering_banner_review_rating') != '') {?>
                          <div class="star-rating" >
                            <?php for ( $i = 1; $i <= 5; $i++ ): ?>
                              <span class="star <?php echo ( $i <= get_theme_mod('event_dining_catering_banner_review_rating') ) ? 'filled' : 'empty'; ?>"></span>
                          <?php endfor; ?>
                          </div>
                        <?php }?>
                      </div>
                    </div>
                  </div>
                <?php }?>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  <?php }?>

  <?php if (get_theme_mod('event_dining_catering_recipe_section_setting', false) != '') { ?>
    <section id="recipe-section" class="py-5 text-center">
      <div class="container">
        <div class="recipe-head mb-3 py-3 text-center">
          <?php if(get_theme_mod('event_dining_catering_recipe_heading') != ''){ ?>
            <h3 class="main-heading mb-4"><?php echo esc_html(get_theme_mod('event_dining_catering_recipe_heading')); ?></h3>
          <?php }?>
          <?php if(get_theme_mod('event_dining_catering_recipe_content') != ''){ ?>
            <p class=""><?php echo esc_html(get_theme_mod('event_dining_catering_recipe_content')); ?></p>
          <?php }?>
        </div>
        <div class="row">
          <?php
            $event_dining_catering_recipe_category = get_theme_mod('event_dining_catering_recipe_category','');
            if($event_dining_catering_recipe_category){
              $event_dining_catering_page_query5 = new WP_Query(array( 'category_name' => esc_html($event_dining_catering_recipe_category,'event-dining-catering'), 'posts_per_page' => 20));
              $i=1;
              while( $event_dining_catering_page_query5->have_posts() ) : $event_dining_catering_page_query5->the_post(); ?>
                <div class="col-lg-4 col-md-4">
                  <div class="recipe-box">
                    <?php if(has_post_thumbnail()) {
                      the_post_thumbnail();
                    }?>
                    <div class="recipe-content">
                      <h4><a href="<?php the_permalink(); ?>"><?php echo wp_trim_words(get_the_title(), 8, '...'); ?></a></h4>
                      <p class="mb-0"><?php echo esc_html( wp_trim_words( get_the_content(),12 )); ?></p>
                    </div>
                  </div>
                </div>
              <?php $i++; endwhile;
            wp_reset_postdata();
          } ?>
        </div>
        <?php if(get_theme_mod('event_dining_catering_recipe_btn_text') != '' || get_theme_mod('event_dining_catering_recipe_btn_url') != ''){?>
          <div class="recipe-btn text-center mt-4">
            <a href="<?php echo esc_url(get_theme_mod('event_dining_catering_recipe_btn_url')); ?>"><?php echo esc_html(get_theme_mod('event_dining_catering_recipe_btn_text')); ?></a>
          </div>
        <?php }?>
      </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(); ?>