<?php
/**
 * Template Name: Custom home page
 */
get_header(); ?>

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

  <?php if( get_theme_mod( 'luxury_travel_slider_hide', true)){?>
    <?php /** slider section **/ ?>
    <section id="slider">
      <div id="carouselExampleIndicators" class="carousel slide" data-bs-ride="carousel" data-bs-interval="<?php echo esc_attr(get_theme_mod('luxury_travel_slider_speed',3000)); ?>"> 
        <?php $luxury_travel_content_pages = array();
          for ( $count = 1; $count <= 4; $count++ ) {
            $mod = intval( get_theme_mod( 'luxury_travel_slidersettings_page' . $count ));
            if ( 'page-none-selected' != $mod ) {
              $luxury_travel_content_pages[] = $mod;
            }
          }
          if( !empty($luxury_travel_content_pages) ) :
          $args = array(
              'post_type' => 'page',
              'post__in' => $luxury_travel_content_pages,
              'orderby' => 'post__in'
          ) ;
          $query = new WP_Query( $args );
          if ( $query->have_posts() ) :
            $i = 1;
        ?>     
        <div class="carousel-inner" role="listbox">
          <?php  while ( $query->have_posts() ) : $query->the_post(); ?>
          <div <?php if($i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
            <?php if(has_post_thumbnail()){
                the_post_thumbnail();
            } else{?>
              <img src="<?php echo esc_url(get_template_directory_uri()); ?>/block-patterns/images/banner.png" alt="" />
            <?php } ?>
            <div class="carousel-caption">
              <div class="inner_carousel">
                <?php if ( get_theme_mod('luxury_travel_slider_title',true) != '' ) {?>
                  <h1><?php the_title(); ?></h1>  
                <?php }?>
                <?php if ( get_theme_mod('luxury_travel_slider_button_label','FIND OUT MORE') != '' && get_theme_mod('luxury_travel_slider_button',true) != ''|| get_theme_mod('luxury_travel_slider_button_link') != '') {?>
                  <div class ="read-more">
                    <a href="<?php echo esc_url(get_theme_mod('luxury_travel_slider_button_link')!= '') ? esc_url(get_theme_mod('luxury_travel_slider_button_link')) : esc_url(get_permalink()); ?>"><?php echo esc_html( get_theme_mod('luxury_travel_slider_button_label',__('FIND OUT MORE','luxury-travel')) ); ?><i class="fas fa-caret-right p-1"></i><span class="screen-reader-text"><?php echo esc_html( get_theme_mod('luxury_travel_slider_button_label',__('FIND OUT MORE','luxury-travel')) ); ?></span></a>
                  </div>  
                <?php }?>                
              </div>
            </div>
            <?php if( get_theme_mod( 'luxury_travel_show_icons' ) != '') { ?>
            <div class="social-media">  
              <?php if( get_theme_mod( 'luxury_travel_facebook_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'luxury_travel_facebook_url','' ) ); ?>"><i class="<?php echo esc_html(get_theme_mod('luxury_travel_facebook_icon','fab fa-facebook-f mt-md-2 mx-md-0 mx-1')); ?>" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Facebook', 'luxury-travel' ); ?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'luxury_travel_twitter_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'luxury_travel_twitter_url','' ) ); ?>"><i class="<?php echo esc_html(get_theme_mod('luxury_travel_twitter_icon','fab fa-twitter mt-md-2 mx-md-0 mx-1')); ?>" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Twitter', 'luxury-travel' ); ?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'luxury_travel_insta_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'luxury_travel_insta_url','' ) ); ?>"><i class="<?php echo esc_html(get_theme_mod('luxury_travel_insta_icon','fab fa-instagram mt-md-2 mx-md-0 mx-1')); ?>" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Instagram', 'luxury-travel' ); ?></span></a>    
              <?php } ?>
              <?php if( get_theme_mod( 'luxury_travel_youtube_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'luxury_travel_youtube_url','' ) ); ?>"><i class="<?php echo esc_html(get_theme_mod('luxury_travel_youtube_icon','fab fa-youtube mt-md-2 mx-md-0 mx-1')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Youtube', 'luxury-travel' ); ?></span></a>
              <?php } ?>
              <?php if( get_theme_mod( 'luxury_travel_pintrest_url') != '') { ?>
                <a target="_blank" href="<?php echo esc_url( get_theme_mod( 'luxury_travel_pintrest_url','' ) ); ?>"><i class="<?php echo esc_html(get_theme_mod('luxury_travel_pintrest_icon','fab fa-pinterest-p mt-md-2 mx-md-0 mx-1')); ?>" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Pinterest', 'luxury-travel' ); ?></span></a>
              <?php } ?>
            </div>
            <?php }?> 
          </div>
          <?php $i++; endwhile; 
          wp_reset_postdata();?>
        </div>
        <?php else : ?>
          <div class="no-postfound"></div>
          <?php endif;
        endif;?>
        <?php if(get_theme_mod('luxury_travel_slider_arrow_hide_show', true)){?>
          <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-bs-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('luxury_travel_slider_prev_icon','fas fa-caret-left')); ?>"></i></span>
            <span class="screen-reader-text"><?php echo esc_html_e('Previous','luxury-travel'); ?></span>
          </a>
          <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-bs-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"><i class="<?php echo esc_attr(get_theme_mod('luxury_travel_slider_next_icon','fas fa-caret-right')); ?>"></i></span>
            <span class="screen-reader-text"><?php echo esc_html_e('Next','luxury-travel'); ?></span>
          </a>
        <?php } ?>  
      </div>  
      <div class="clearfix"></div>
    </section> 
  <?php }?>

  <div class="header-nav">
    <div id="header">
      <div class="menu-sec <?php if( get_theme_mod( 'luxury_travel_sticky_header') != '') { ?> sticky-header"<?php } else { ?>close-sticky <?php } ?>">
        <div class="container">
          <div class="row">
            <div class="logo col-lg-3 col-md-5 wow bounceInDown py-1 text-center align-self-center">
              <?php if ( has_custom_logo() ) : ?>
                <div class="site-logo"><?php the_custom_logo(); ?></div>
              <?php endif; ?>
              <?php $blog_info = get_bloginfo( 'name' ); ?>
              <?php if ( ! empty( $blog_info ) ) : ?>
                <?php if ( is_front_page() && is_home() ) : ?>
                  <h1 class="site-title p-0 text-center"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                <?php else : ?>
                  <p class="site-title m-0 text-center"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                <?php endif; ?>
              <?php endif; ?>
              <?php
              $description = get_bloginfo( 'description', 'display' );
              if ( $description || is_customize_preview() ) :
                ?>
                <p class="site-description m-0 text-center">
                  <?php echo esc_html($description); ?>
                </p>
              <?php endif; ?>
            </div>
            <div class="menubox col-lg-7 col-md-3 align-self-center">
              <div id="sidelong-menu" class="nav side-nav">
                <nav id="primary-site-navigation" class="nav-menu" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'luxury-travel' ); ?>">
                  <?php if (has_nav_menu('primary')){ 
                    wp_nav_menu( array( 
                      'theme_location' => 'primary',
                      'container_class' => 'main-menu-navigation clearfix' ,
                      'menu_class' => 'clearfix',
                      'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
                      'fallback_cb' => 'wp_page_menu',
                    ) ); 
                  } ?>
                </nav>
              </div>
            </div>
            <div class="top-contact col-lg-2 col-md-4 my-md-4 p-md-0 p-2 text-center align-self-center">
              <?php if( get_theme_mod( 'luxury_travel_call','' ) != '') { ?>
                <a href="<?php echo esc_url( get_theme_mod( 'luxury_travel_call','' ) ); ?>"><i class="fa fa-phone me-2" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Call Link', 'luxury-travel' ); ?></span></a>
              <?php } ?>     
              <?php if( get_theme_mod( 'luxury_travel_mail','' ) != '') { ?>
                <a href="<?php echo esc_url( get_theme_mod( 'luxury_travel_mail','' ) ); ?>"><i class="fa fa-envelope" aria-hidden="true"></i><span class="screen-reader-text"><?php esc_html_e( 'Email Link', 'luxury-travel' ); ?></span></a>
              <?php } ?>
            </div>
          </div>
        </div>
      </div>
    </div> 
  </div>
  
  <main id="maincontent" role="main">
    <?php if( get_theme_mod( 'luxury_travel_maintitle') != '') { ?>
      <section id="our-products" class="py-5">
        <div class="container">
          <div class="text-center">
            <?php if( get_theme_mod('luxury_travel_maintitle') != ''){ ?>     
              <h2 class="mb-3"><?php echo esc_html(get_theme_mod('luxury_travel_maintitle','')); ?></h2>
            <?php }?>
          </div>
          <?php $luxury_travel_content_pages = array();
          for ( $count = 0; $count <= 3; $count++ ) {
            $mod = absint( get_theme_mod( 'luxury_travel_page' . $count ));
            if ( 'page-none-selected' != $mod ) {
              $luxury_travel_content_pages[] = $mod;
            }
          }
          if( !empty($luxury_travel_content_pages) ) :
            $args = array(
              'post_type' => 'page',
              'post__in' => $luxury_travel_content_pages,
              'orderby' => 'post__in'
            );
            $query = new WP_Query( $args );
            if ( $query->have_posts() ) :
              $count = 0;
              while ( $query->have_posts() ) : $query->the_post(); ?>
                <div class=" box-image">
                  <?php the_content(); ?>
                  <div class="clearfix"></div>
                </div>
              <?php $count++; endwhile; 
              wp_reset_postdata(); ?>
            <?php else : ?>
              <div class="no-postfound"></div>
            <?php endif;
          endif;?>
          <div class="clearfix"></div> 
        </div>
      </section>
    <?php }?>
      
    <?php do_action('luxury_travel_above_about_section'); ?>

    <?php if( get_theme_mod( 'luxury_travel_about_setting') != '') { ?>
      <?php /*--About Us--*/?>
      <section class="about py-5">
        <div class="container">
          <div class="row">
            <?php
              $luxury_travel_postData1 =  get_theme_mod('luxury_travel_about_setting');
              if($luxury_travel_postData1){
                $args = array( 'p' => esc_html($luxury_travel_postData1 ,'luxury-travel'),
                'post_type' => 'post');
              $query = new WP_Query( $args );
              if ( $query->have_posts() ) :
                while ( $query->have_posts() ) : $query->the_post(); ?>
                  <div class="col-lg-8 col-md-8">
                    <a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?></h3><span class="screen-reader-text"><?php the_title(); ?></span></a>
                    <p class="m-0"><?php the_excerpt(); ?></p>
                  </div>
                  <div class="col-lg-4 col-md-4">
                    <div class="abt-image">
                      <?php the_post_thumbnail(); ?>
                    </div>
                  </div>          
                <?php endwhile; 
                wp_reset_postdata();?>
              <?php else : ?>
                <div class="no-postfound"></div>
              <?php
            endif; }?>
          </div>
        </div>
      </section>
    <?php }?>

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

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

<?php get_footer(); ?>