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

get_header(); ?>

<main id="maincontent" role="main">
  <?php if( get_theme_mod( 'ecommerce_landing_page_show_hide_banner',true) != '' || get_theme_mod( 'ecommerce_landing_page_resp_slider_hide_show', true) != '') { ?>
    <section id="banner" class="position-relative wow bounceInDown delay-1000" data-wow-duration="3s">
      <div class="container">
        <div class="row">
          <div class="col-lg-6 col-md-6 col-xs-12 banner-main-text align-self-center">
            <div class="inner_carousel">
              <?php if(get_theme_mod('ecommerce_landing_page_tagline_title1') != '') {?>
                <span class="banner-small-heading mb-3"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_tagline_title1')) ?></span>
              <?php }?>
              <?php if(get_theme_mod('ecommerce_landing_page_tagline_title') != '') {?>
                <h2 class="mb-3"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_tagline_title')) ?></h2>
              <?php }?>
              <?php if(get_theme_mod('ecommerce_landing_page_designation_text') != '') {?>
                <p class="slider-para"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_designation_text')) ?></p>
              <?php }?>
              <?php if ( get_theme_mod('ecommerce_landing_page_banner_button_label','Join Now') != '' ) {?>
                <div class ="read-more mt-md-4 mt-0">
                  <a href="<?php echo esc_url(get_theme_mod('ecommerce_landing_page_top_button_url',false));?>"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_banner_button_label','Join Now'));?>
                    <span class="screen-reader-text"><?php esc_html_e( 'Join Now','educational-landing-page');?></span>
                  </a>
                </div>
              <?php }?>
            </div>
          </div>
          <div class="col-lg-6 col-md-6 col-xs-12 banner-img text-center align-self-lg-center">
            <div class="row">
              <div class="col-lg-6 col-md-6 col-6 align-self-center">
                <div class="banner-image">
                  <?php if(get_theme_mod('educational_landing_page_banner_image') != '') {?>
                    <img src="<?php echo esc_url(get_theme_mod('educational_landing_page_banner_image')); ?>" alt="" />
                  <?php }?>
                </div>
              </div>
              <div class="col-lg-6 col-md-6 col-6 align-self-center">
                <div class="banner-image1">
                  <?php if(get_theme_mod('educational_landing_page_banner_image1') != '') {?>
                    <img src="<?php echo esc_url(get_theme_mod('educational_landing_page_banner_image1')); ?>" alt="" />
                  <?php }?>
                </div>
              </div>
            </div>
            <div class="row">
              <div class="col-lg-6 col-md-6 col-6 align-self-center">
                <div class="banner-image2">
                  <?php if(get_theme_mod('educational_landing_page_banner_image2') != '') {?>
                    <img src="<?php echo esc_url(get_theme_mod('educational_landing_page_banner_image2')); ?>" alt="" />
                  <?php }?>
                </div>
              </div>
              <div class="col-lg-6 col-md-6 col-6 align-self-center">
                <div class="banner-image3 position-relative">
                  <?php if(get_theme_mod('educational_landing_page_banner_image3') != '') {?>
                    <img src="<?php echo esc_url(get_theme_mod('educational_landing_page_banner_image3')); ?>" alt="" />
                  <?php }?>
                </div>
              </div>
            </div>
          </div>
           <div class="banner-image-line"><img src="<?php echo esc_url(get_stylesheet_directory_uri()); ?>/assets/images/banner-line.png" alt="" /></div>
        </div>
      </div>
      <div class="clearfix"></div>
    </section>
  <?php }?>

  <?php do_action( 'ecommerce_landing_page_after_slider' ); ?>

  <!--  Feature Courses Section -->
  <?php if( get_theme_mod('ecommerce_landing_page_feature_category') != ''){ ?>
    <section id="feature-courses-section" class="wow bounceInDown delay-1000 py-5" data-wow-duration="3s">
      <div class="container">
        <div class="feature-courses text-center">
          <?php if(get_theme_mod('educational_landing_page_feature_courses_tagline_title1') != '') {?>
            <span class="feature-courses-span "><?php echo esc_html(get_theme_mod('educational_landing_page_feature_courses_tagline_title1')) ?></span>
          <?php }?>
          <?php if(get_theme_mod('educational_landing_page_feature_courses_tagline_title') != '') {?>
            <h3 class=""><?php echo esc_html(get_theme_mod('educational_landing_page_feature_courses_tagline_title')) ?></h3>
          <?php }?>
          <?php if(get_theme_mod('educational_landing_page_feature_courses_designation_text') != '') {?>
            <p class="slider-para"><?php echo esc_html(get_theme_mod('educational_landing_page_feature_courses_designation_text')) ?></p>
          <?php }?>
        </div>
        <div class="row">
          <?php
            $ecommerce_landing_page_catdata=  get_theme_mod('ecommerce_landing_page_feature_category');
            if($ecommerce_landing_page_catdata){
            $page_query = new WP_Query(array( 'category_name' => esc_html($ecommerce_landing_page_catdata ,'educational-landing-page'))); ?>
            <?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
              <div class="col-lg-3 col-md-6 pb-5">
                <div class="feature-box position-relative">
                  <?php if(has_post_thumbnail()){
                   the_post_thumbnail(); ?>
                   <?php } ?>
                  <div class="feature-main-div">
                    <div class="star-myaccount d-flex gap-4 mt-2">
                      <?php $educational_landing_page_rating = get_post_meta(get_the_ID(), 'educational_landing_page_rating', true);?>
                        <article class="d-flex gap-2">
                          <?php if ($educational_landing_page_rating) : ?>
                              <div class="star-rating">
                                <?php
                                  for ($i = 0; $i < $educational_landing_page_rating; $i++) {
                                    echo '<i class="'.esc_attr("fas fa-star").'"></i>';
                                  }
                                ?>
                              </div>
                              <?php if( get_post_meta($post->ID, 'educational_landing_page_rating1', true) ) {?>
                                <div class="user-meta-fields">
                                    <?php if( get_post_meta($post->ID, 'educational_landing_page_rating1', true) ) {?>
                                      <span class="user-text1"><?php echo esc_html(get_post_meta($post->ID,'educational_landing_page_rating1',true)); ?></span>
                                    <?php }?>
                                </div>
                              <?php }?>
                          <?php endif; ?>
                        </article>
                      <?php ?>
                      <?php if( get_post_meta($post->ID, 'educational_landing_page_user', true) ) {?>
                        <div class="user-meta-fields">
                          <?php if( get_post_meta($post->ID, 'educational_landing_page_user', true) ) {?>
                            <i class='fas fa-user me-2'></i><span class="user-text"><?php echo esc_html(get_post_meta($post->ID,'educational_landing_page_user',true)); ?></span>
                          <?php }?>
                        </div>
                      <?php }?>
                    </div>
                    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h3>
                    <div class="price-text d-flex gap-2">
                      <?php if( get_post_meta($post->ID, 'educational_landing_page_price_sec', true) ) {?>
                        <span class="price-text-sec"><?php esc_html_e( '$','educational-landing-page');?><?php echo esc_html(get_post_meta($post->ID,'educational_landing_page_price_sec',true)); ?></span>
                      <?php }?>
                      <?php if( get_post_meta($post->ID, 'educational_landing_page_price_sec1', true) ) {?>
                        <span class="price-text-sec1"><?php esc_html_e( '$','educational-landing-page');?><?php echo esc_html(get_post_meta($post->ID,'educational_landing_page_price_sec1',true)); ?></span>
                      <?php }?>
                    </div>
                  </div>
                </div>
              </div>
            <?php endwhile;
            wp_reset_postdata();}
          ?>
        </div>

      </div>
    </section>
  <?php }?>

  <!-- latest news and blog Section -->
  <?php if( get_theme_mod( 'ecommerce_landing_page_latest_news_blog_heading')|| get_theme_mod( 'ecommerce_landing_page_latest_news_blog_small_title') || get_theme_mod( 'ecommerce_landing_page_events_category')) { ?>
    <section id="latest-post-section" class="wow bounceInDown delay-1000" data-wow-duration="3s">
      <div class="container">
        <div class="latest-post-head">
          <?php if( get_theme_mod('ecommerce_landing_page_latest_news_blog_heading') != '' ){ ?>
            <h4 class="heading-text text-center"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_latest_news_blog_heading',''));?></h4>
          <?php }?>
          <?php if( get_theme_mod('ecommerce_landing_page_latest_news_blog_small_title') != '' ){ ?>
            <p class="small-text text-center"><?php echo esc_html(get_theme_mod('ecommerce_landing_page_latest_news_blog_small_title',''));?></p>
          <?php }?>
        </div>
        <div class="row">
          <?php
            $ecommerce_landing_page_catdata=  get_theme_mod('ecommerce_landing_page_events_category');
            if($ecommerce_landing_page_catdata){
            $page_query = new WP_Query(array( 'category_name' => esc_html($ecommerce_landing_page_catdata ,'educational-landing-page'))); ?>
            <?php while( $page_query->have_posts() ) : $page_query->the_post(); ?>
              <div class="col-lg-4 col-md-6 pb-5">
                <div class="events-box position-relative">
                  <?php if(has_post_thumbnail()){
                   the_post_thumbnail(); ?>
                  <span class="event-date"><?php echo esc_html( get_the_date() ); ?></span>
                  <?php } ?>
                  <span class="event-location"><?php the_category(); ?></span>
                  <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h5>
                  <div class="author-comment d-flex gap-4 align-items-center">
                    <?php if( get_theme_mod( 'ecommerce_landing_page_blog_latest_post_author',true) == 1 || get_theme_mod( 'ecommerce_landing_page_blog_latest_post_comments',true) == 1 ) { ?>
                      <?php if(get_theme_mod('ecommerce_landing_page_blog_latest_post_author',true)==1){ ?>
                        <span class="entry-author">
                          <i class="<?php echo esc_attr(get_theme_mod('ecommerce_landing_page_latest_post_author_icon','fas fa-user')); ?> me-2">
                          </i>
                          <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' )) ); ?>"><?php the_author(); ?>
                            <span class="screen-reader-text"><?php the_author(); ?></span>
                          </a>
                        </span>
                      <?php } ?>
                      <?php if(get_theme_mod('ecommerce_landing_page_blog_latest_post_comments',true)==1){ ?>
                        <span class="entry-comments">
                          <i class="<?php echo esc_attr(get_theme_mod('ecommerce_landing_page_latest_post_comments_icon','fas fa-comment')); ?> me-2" aria-hidden="true">
                          </i>
                          <?php comments_number( __('0 Comment', 'educational-landing-page'), __('0 Comments', 'educational-landing-page'), __('% Comments', 'educational-landing-page') ); ?>
                        </span>
                      <?php } ?>
                    <?php } ?>
                  </div>
                </div>
              </div>
            <?php endwhile;
            wp_reset_postdata();}
          ?>
        </div>
      </div>
    </section>
  <?php }?>
  <?php do_action( 'ecommerce_landing_page_after_latest_news_blog_section' ); ?>

  <div id="content-vw" class="py-3">
    <div class="container">
      <?php while ( have_posts() ) : the_post(); ?>
        <?php the_content(); ?>
      <?php endwhile; // end of the loop. ?>
    </div>
  </div>
</main>

<?php get_footer(); ?>
