<?php
/**
 * Template Name: Custom Home Page
 */
get_header(); ?>

<main id="content">
  <?php if( get_option('forest_nature_slider_arrows', false) !== 'off'){ ?>
    <section id="slider">
      <div class="owl-carousel">
        <?php
          $forest_nature_slider_category=  get_theme_mod('forest_nature_post_setting');if($forest_nature_slider_category){
          $forest_nature_page_query = new WP_Query(array( 

              'category_name' => esc_html($forest_nature_slider_category ,'forest-nature'),

              'posts_per_page' => get_theme_mod('forest_nature_slider_count')

            ));?>
            <?php while( $forest_nature_page_query->have_posts() ) : $forest_nature_page_query->the_post(); ?>
            <div class="slide-box">
             <?php if(has_post_thumbnail()){ ?>
              <img src="<?php the_post_thumbnail_url('full'); ?>"/>
            <?php }else{?>
              <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/images/header-img.png" alt="" />
            <?php } ?>
              <div class="slide-inner-box slider-inner">
                <?php if( get_theme_mod('forest_nature_slide_heading') != ''){ ?>
                  <h3><?php echo esc_html(get_theme_mod('forest_nature_slide_heading','')); ?></h3>
                <?php }?>
                <a href="<?php the_permalink(); ?>"><h2 class="slider-title"><?php the_title();?></h2></a>
                <?php if( get_option('forest_nature_slider_excerpt_show_hide',false) != 'off'){ ?>
                  <p class="slider-excerpt mb-0"><?php echo wp_trim_words(get_the_content(), get_theme_mod('forest_nature_slider_excerpt_count',30) );?></p>
                <?php } ?>
                <div class="home-btn my-4">
                  <a href="<?php the_permalink(); ?>"><?php echo esc_html(get_theme_mod('forest_nature_slider_read_more',__('Read More','forest-nature'))); ?></a>
                </div>
              </div>
            </div>
            <?php endwhile;
          wp_reset_postdata();
        }?>
      </div>
    </section>
  <?php }?>
  <?php if( get_option('forest_nature_about_enable', false) !== 'off'){ ?>
    <section id="home-about" class="py-5">
      <div class="container">
        <div class="row">
          <?php
            $forest_nature_mod =  get_theme_mod( 'forest_nature_about_us_settigs');
            if ( 'page-none-selected' != $forest_nature_mod ) {
              $forest_nature_about_page[] = $forest_nature_mod;
            }
            if( !empty($forest_nature_about_page) ) :
            $forest_nature_args = array(
              'post_type' =>array('page'),
              'post__in' => $forest_nature_about_page
            );
            $forest_nature_query = new WP_Query( $forest_nature_args );
            if ( $forest_nature_query->have_posts() ) :
          ?>
          <?php while ( $forest_nature_query->have_posts() ) : $forest_nature_query->the_post(); ?>
            <div class="column1 col-lg-6 col-md-6 col-sm-6 align-self-center wow zoomIn delay-1000"data-wow-duration="3s">
              <?php if(has_post_thumbnail()){ ?>
                <?php the_post_thumbnail(); ?>
              <?php }?>
            </div>
            <div class="column2 col-lg-6 col-md-6 col-sm-6 align-self-center">
              <h4 class="mb-4"><?php the_title();?></h4>
              <?php if( get_theme_mod('forest_nature_services_heading') != ''){ ?>
                <h6><?php echo esc_html(get_theme_mod('forest_nature_services_heading','')); ?></h6>
              <?php }?>
              <p class="mb-0"><?php the_excerpt(); ?></p>
              <div class="home-btn text-center text-sm-start my-4">
                <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','forest-nature'); ?></a>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();?>
          <?php else : ?>
          <div class="no-postfound"></div>
            <?php endif;
          endif;?>
      </div>
    </section>
  <?php }?>
  <section id="custom-page-content" <?php if ( have_posts() && trim( get_the_content() ) !== '' ) echo 'class="pt-3"'; ?>>
    <div class="container">
      <?php while ( have_posts() ) : the_post(); ?>
        <?php the_content(); ?>
      <?php endwhile; ?>
    </div>
  </section>
</main>

<?php get_footer(); ?>
