<?php
/**
 * The Template Name: Home Page
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package Cooking Classes
 */

get_header(); ?>

<div id="content" >
  <?php
    $cooking_classes_hidcat_slide = get_theme_mod('cooking_classes_hide_categorysec', false);
    $cooking_classes_slidersection = get_theme_mod('cooking_classes_slidersection');

    if ($cooking_classes_hidcat_slide && $cooking_classes_slidersection) { ?>
  <section id="slider">
      <div class="overlayer2"></div>
    <div class="owl-carousel owl-theme">
    <?php if( get_theme_mod('cooking_classes_slidersection',false) ) { ?>
          <?php $cooking_classes_query_var = new WP_Query('cat='.esc_attr(get_theme_mod('cooking_classes_slidersection',false)));
            while( $cooking_classes_query_var->have_posts() ) : $cooking_classes_query_var->the_post(); ?>
      <div class="item">
        <div class="col-lg-12 col-md-12 pd-0">
          <div class="row md-0">
        <div class="col-lg-9 col-md-8 pd-0">
          <div class="content d-flex align-items-center position-relative sliderimgshap">
            <?php if(has_post_thumbnail()){
              the_post_thumbnail('full');
              } else{?>
              <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/slider.png" alt="<?php echo esc_attr( 'slider', 'cooking-classes'); ?>"/>
            <?php } ?>
          </div>
        </div>
        <div class="col-lg-3 col-md-4 pd-0 res-cont-box">
         
         <div class="overlayer"></div>
            <div class="slider-conten">
              <h1 class="title-slider text-white mb-4">
              <a href="<?php echo esc_url( get_permalink() );?>"><?php the_title(); ?></a>
              </h1>
               <?php
                      $cooking_classes_trim_excerpt = get_the_excerpt();
                      $cooking_classes_short_excerpt = wp_trim_words( $cooking_classes_trim_excerpt, $num_words = 55 );
                      echo ' <p class="text-slider text-white mb-4  fw-normal">' . esc_html( $cooking_classes_short_excerpt ) . '</p>'; 
                    ?>
              <div class="d-flex gap-4 slider-buttons">

                <?php if ( get_theme_mod('cooking_classes_button_text','true') != "" || get_theme_mod('cooking_classes_button_link_slider') != '') { ?>
                  <a href="<?php echo esc_url(get_theme_mod('cooking_classes_button_link_slider')!= '') ? esc_url(get_theme_mod('cooking_classes_button_link_slider')) : esc_url(get_permalink()); ?>" class="button-slider redmor btn fs-5 px-4 py-2 text-white" style="background-color: var(--second-theme-color);"><div class="btninn"></div>
                  <?php echo esc_html(get_theme_mod('cooking_classes_button_text',__('Read More','cooking-classes'))); ?>
                </a>
                <?php }?>
                <?php if ( get_theme_mod('cooking_classes_button2_text','true') != "" && get_theme_mod('cooking_classes_button2_url') != '') { ?>
                  <a href="<?php echo esc_url(get_theme_mod('cooking_classes_button2_url')); ?>" class="button-slider cont-us btn px-4 py-2 text-white" style="background-color: transparent;">
                    <?php echo esc_html(get_theme_mod('cooking_classes_button2_text',__('Contact Us','cooking-classes'))); ?>
                  </a>
                <?php }?>
              </div>
              <div class="clear"></div>
            </div>
        </div><!-- col 6 content -->
          
       <!--  </div> -->
     </div>
     </div>
      </div>
      <?php endwhile; wp_reset_postdata(); ?>
          <?php } ?>
    </div>
  </section>
  <?php } ?>

  <?php
    $cooking_classes_hidepageboxes = get_theme_mod('cooking_classes_disabled_pgboxes', false);
    $cooking_classes_services_cat = get_theme_mod('cooking_classes_services_cat');
    if( $cooking_classes_hidepageboxes && $cooking_classes_services_cat){
  ?>
    
  <section id="service" class="py-5" style="background-color: #efebe5;">
      <div class="container">
          <div class="text-center  mx-auto d-block">
              <div class="section-heading">
                <img src="<?php echo esc_url(get_template_directory_uri() .'/images/heading2.png'); ?>" alt="ser" class="headimg blink img-responsive">
                <h2 class=" fs-1 text-uppercase fw-bold" style="color: #46557a;">
                  <?php echo esc_html(get_theme_mod('cooking_classes_service_heading',__('POPULAR CLASSES','cooking-classes'))); ?>
                </h2>
                <div class="heading-border"></div>
                  <img src="<?php echo esc_url(get_template_directory_uri() .'/images/heading1.png'); ?>" alt="ser" class="headimg headimgrhs blink img-responsive">
                <div class="clear"></div>
              </div>
          </div>
      </div>
      <div class="pt-3">
          <div class="container">
              <div class="row">
              <?php if( get_theme_mod('cooking_classes_services_cat',false) ) { ?>
                <?php $cooking_classes_query_var = new WP_Query('cat='.esc_attr(get_theme_mod('cooking_classes_services_cat',false)));
                  while( $cooking_classes_query_var->have_posts() ) : $cooking_classes_query_var->the_post(); ?>  

                  <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12 colume-row serbx">
                      <div class="services-box"> 
                        <?php if(has_post_thumbnail()){
                          the_post_thumbnail('full');
                          } else{?>
                          <img src="<?php echo esc_url(get_template_directory_uri()); ?>/images/service.png" alt="<?php echo esc_attr( 'slider', 'cooking-classes'); ?>"/>
                        <?php } ?>
                      </div>
                      <div class="content">
                          <div class="">
                              <h3 class="text-uppercase "><a href="<?php echo esc_url( get_permalink() );?>"><?php the_title(); ?></a></h3>
                              <?php
                                $cooking_classes_trim_excerpt = get_the_excerpt();
                                $cooking_classes_short_excerpt = wp_trim_words( $cooking_classes_trim_excerpt, $num_words = 20 );
                                echo '<p class="text-center fs-5 fw-light mb-0">' . esc_html( $cooking_classes_short_excerpt ) . '</p>'; 
                              ?>
                              <a href="<?php the_permalink(); ?>" class="button-service redmor btn fs-5 px-4 py-2 text-white" style="background-color: var(--second-theme-color);">
                                  <div class="btninn"></div>
                                <?php echo esc_html(get_theme_mod('cooking_classes_servicebutton_text',__('LEARN MORE','cooking-classes'))); ?>
                              </a>
                          </div>
                      </div>
                  </div>

                <?php endwhile; wp_reset_postdata(); ?>
                <?php } ?>
              </div>
          </div>
      </div>
  </section>
  <?php }?>

</div>

<?php get_footer(); ?>