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

get_header(); ?>

<main id="skip-content">
  <section id="top-slider">
    <?php $motivational_life_coach_slide_pages = array();
      for ( $motivational_life_coach_count = 1; $motivational_life_coach_count <= 3; $motivational_life_coach_count++ ) {
        $motivational_life_coach_mod = intval( get_theme_mod( 'motivational_life_coach_top_slider_page' . $motivational_life_coach_count ));
        if ( 'page-none-selected' != $motivational_life_coach_mod ) {
          $motivational_life_coach_slide_pages[] = $motivational_life_coach_mod;
        }
      }
      if( !empty($motivational_life_coach_slide_pages) ) :
        $motivational_life_coach_args = array(
          'post_type' => 'page',
          'post__in' => $motivational_life_coach_slide_pages,
          'orderby' => 'post__in'
        );
        $motivational_life_coach_query = new WP_Query( $motivational_life_coach_args );
        if ( $motivational_life_coach_query->have_posts() ) :
          $i = 1;
    ?>
    <div class="owl-carousel" role="listbox">
      <?php  while ( $motivational_life_coach_query->have_posts() ) : $motivational_life_coach_query->the_post(); ?>
        <div class="slider-box">
          <?php if(has_post_thumbnail()){
            the_post_thumbnail();
            } else{?>
            <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/slider.png" alt="" />
          <?php } ?>
          <div class="slider-inner-box">
            <?php if(get_theme_mod('motivational_life_coach_slider_heading') != ''){ ?>
              <h3 class="heading mb-4"><?php echo esc_html(get_theme_mod('motivational_life_coach_slider_heading')); ?></h3>
            <?php }?>
            <h2 class="m-0"><?php the_title(); ?></h2>
            <p class="content mt-3"><?php echo esc_html( wp_trim_words( get_the_content(),esc_attr(get_theme_mod('motivational_life_coach_slider_excerpt_length', 30)) )); ?></p>
            <div class="slide-btn mt-4"><a href="<?php the_permalink(); ?>"><?php esc_html_e('Know More','motivational-life-coach'); ?></a></div>
          </div>
        </div>
      <?php $i++; endwhile;
      wp_reset_postdata();?>
    </div>
    <?php else : ?>
      <div class="no-postfound"></div>
    <?php endif;
    endif;?>
  </section>

  <section class="service-sec">
    <div class="container">
      <?php if(get_theme_mod('motivational_life_coach_services_sec_category','')){ ?>
        <div class="box-ser">
          <div class="ser-heading text-center">
            <?php if(get_theme_mod('motivational_life_coach_services_title') != ''){ ?>
              <h3 class="main-heading text-center"><?php echo esc_html(get_theme_mod('motivational_life_coach_services_title')); ?></h3>
            <?php }?>
          </div>
          <div class="row m-0 pt-4 px-3">
            <?php
              $motivational_life_coach_services_cat = get_theme_mod('motivational_life_coach_services_sec_category','');
              if($motivational_life_coach_services_cat){
                $motivational_life_coach_page_query5 = new WP_Query(array( 'category_name' => esc_html($motivational_life_coach_services_cat,'motivational-life-coach'),'posts_per_page' => 3));
                $i=1;
                while( $motivational_life_coach_page_query5->have_posts() ) : $motivational_life_coach_page_query5->the_post(); ?>
                <?php if(get_theme_mod('motivational_life_coach_services_icon'.$i,'fas fa-search')){ ?>
                  <div class="col-lg-4 col-md-4 col-sm-12 col-12 <?php echo esc_attr(('serbox-').$i ); ?>">
                    <div class="row">
                      <div class="col-lg-3 col-md-3 col-sm-3 col-3 ser-icon text-center">
                        <i class="<?php echo esc_attr(get_theme_mod('motivational_life_coach_services_icon'.$i,'fas fa-search')); ?>"></i>
                      </div>
                      <div class="col-lg-9 col-md-9 col-sm-9 col-9 ser-content">
                        <h4 class="mb-3"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                        <p><?php echo esc_html( wp_trim_words( get_the_content(), 15 )); ?></p>
                      </div>
                    </div>
                  </div>
                <?php }?>
                <?php $i++; endwhile;
              wp_reset_postdata();
            } ?>
          </div>
        </div>
      <?php }?>
    </div>
  </section>

  <section class="about-sec py-5">
    <div class="container">
      <div class="row">
        <div class="col-lg-5 col-md-5 col-sm-5 col-12 about-img text-end align-self-center">
          <?php if(get_theme_mod('motivational_life_coach_about_image') != ''){ ?>
            <img src="<?php echo esc_url(get_theme_mod('motivational_life_coach_about_image')); ?>">
          <?php }?>
        </div>
        <div class="col-lg-7 col-md-7 col-sm-7 col-12 align-self-center">
          <div class=" text-start headings">
            <?php if(get_theme_mod('motivational_life_coach_about_short_heading') != ''){ ?>
              <h4 class="mb-4"><?php echo esc_html(get_theme_mod('motivational_life_coach_about_short_heading','')); ?></h4>
            <?php }?>
            <?php if(get_theme_mod('motivational_life_coach_about_heading') != ''){ ?>
              <h3 class="mb-3"><?php echo esc_html(get_theme_mod('motivational_life_coach_about_heading','')); ?></h3>
            <?php }?>
            <?php if(get_theme_mod('motivational_life_coach_about_discription') != ''){ ?>
              <p><?php echo esc_html(get_theme_mod('motivational_life_coach_about_discription','')); ?></p>
            <?php }?>
            <?php if(get_theme_mod('motivational_life_coach_about_button_url') != '' || get_theme_mod('motivational_life_coach_about_button_text') != '' ){ ?>
              <div class="about-btn mt-4"><a href="<?php echo esc_url(get_theme_mod('motivational_life_coach_about_button_url','')); ?>"><?php echo esc_html(get_theme_mod('motivational_life_coach_about_button_text','')); ?></a></div>
            </div>
          <?php }?>
        </div>
      </div>
    </div>
  </section>
  <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(); ?>