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

?>
<!-- banner section -->
<main id="maincontent" role="main">

  <?php do_action( 'archaeology_museums_above_banner' ); ?>
  <?php if (get_theme_mod('archaeology_museums_show_hide_banner', false) || get_theme_mod( 'archaeology_museums_resp_slider_hide_show', false) == 1) { ?>
    <section id="banner" class="position-relative wow fadeInRightBig" data-wow-duration="2s">
      <div class="banner-content">
        <div class="container">
          <div class="row">
            <div class="col-xl-6 col-lg-6 col-md-6 col-12 align-self-center">
              <div class="inner_carousel text-start pt-5">
                <?php if(get_theme_mod('archaeology_museums_subheading') != '') {?>
                  <p class="banner-sub-head text-capitalize"><?php echo esc_html(get_theme_mod('archaeology_museums_subheading')) ?></p>
                <?php }?>
                <?php if(get_theme_mod('archaeology_museums_tagline_title') != '') {?>
                  <div class="position-relative">
                    <h1 class="mb-3 text-capitalize banner-title"><?php echo esc_html(get_theme_mod('archaeology_museums_tagline_title')) ?></h1>
                  </div>
                <?php }?>
                <?php if(get_theme_mod('archaeology_museums_designation_text') != '') {?>
                  <p class="banner-para"><?php echo esc_html(get_theme_mod('archaeology_museums_designation_text')) ?></p>
                <?php }?>
                <?php if ( get_theme_mod('archaeology_museums_banner_button_label') != '' ) {?>
                  <div class ="banner-btn mt-4 mb-5">
                    <a href="<?php echo esc_url(get_theme_mod('archaeology_museums_top_button_url',false));?>" class="text-capitalize"><?php echo esc_html(get_theme_mod('archaeology_museums_banner_button_label'));?>
                    </a>
                  </div>
                <?php }?>
              </div>
            </div>
            <div class="col-xl-6 col-lg-6 col-md-6 col-12 align-self-center">
              <?php if (get_theme_mod('archaeology_museums_banner_image') != "") { ?>
                <div class="banner-side-img">
                  <img class="banner-img" src="<?php echo esc_url(get_theme_mod('archaeology_museums_banner_image')); ?>" alt="" title="<?php echo esc_attr('#bannerimage'); ?>">
                </div>
              <?php } else { ?>
                <div class="banner-side-img">
                  <img class="banner-img" src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/banner.png'); ?>" alt="" title="<?php echo esc_attr('#bannerimage'); ?>">
                </div>
              <?php } ?>
            </div>
          </div>
          <?php if (get_theme_mod('archaeology_museums_banner_left_image') != "") { ?>
            <div class="banner-left">
              <img class="banner-left-img" src="<?php echo esc_url(get_theme_mod('archaeology_museums_banner_left_image')); ?>" alt="" title="<?php echo esc_attr('#smallimage'); ?>">
            </div>
          <?php } else { ?>
            <div class="banner-left">
              <img class="banner-left-img" src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/banner-side.png'); ?>" alt="" title="<?php echo esc_attr('#smallimage'); ?>">
            </div>
          <?php } ?>
        </div>
      </div>
      <div class="thread">
        <img class="thread-img" src="<?php echo esc_url(get_template_directory_uri() . '/assets/images/banner-thread.svg') ?>" alt="">
      </div>
      <div class="clearfix"></div>
    </section>
  <?php }?>
  <?php do_action( 'archaeology_museums_below_banner' ); ?>

  <!-- Discovery Section -->
  <?php if (get_theme_mod('archaeology_museums_discovery_section_hide_show', true)){ ?>
    <section id="discovery-section" class="wow fadeInLeftBig" data-wow-delay="2s">
      <div class="container">
        <?php if(get_theme_mod('archaeology_museums_discovery_category') != '') {?>
          <div class="row">
            <div class="col-xl-3 col-lg-3 col-md-6 col-12 gold-ball position-relative"></div>
            <div class="col-xl-3 col-lg-3 col-md-6 col-12 gold-ball position-relative"></div>
            <div class="col-xl-3 col-lg-3 col-md-6 col-12 gold-ball position-relative"></div>
            <div class="col-xl-3 col-lg-3 col-md-6 col-12 gold-ball position-relative"></div>
          </div>
        <?php }?>
        <div class="section-content text-center mb-5">
          <?php if(get_theme_mod('archaeology_museums_discovery_section_text') != '') {?>
            <div class="title-bg mb-2">
              <p class="section-text mb-2 text-uppercase"><?php echo esc_html(get_theme_mod('archaeology_museums_discovery_section_text')) ?></p>
            </div>
          <?php }?>
          <?php if(get_theme_mod('archaeology_museums_discovery_section_title') != '') {?>
            <h2 class="section-title text-capitalize pb-2"><?php echo esc_html(get_theme_mod('archaeology_museums_discovery_section_title')) ?></h2>
          <?php }?>
        </div>
        <div class="row">
          <?php
            $archaeology_museums_catdata=  get_theme_mod('archaeology_museums_discovery_category');
            if($archaeology_museums_catdata){
            $archaeology_museums_page_query = new WP_Query(array(
              'category_name' => esc_html($archaeology_museums_catdata, 'archaeology-museums'),
              'posts_per_page' => 4
            ));  
          ?>         
          <?php while( $archaeology_museums_page_query->have_posts() ) : $archaeology_museums_page_query->the_post(); ?>
            <div class="col-xl-3 col-lg-3 col-md-6 col-12 p-0 post-box align-self-end">
              <div class="catgory-box">
                <div class="post-img position-relative">
                  <?php if(has_post_thumbnail()){ ?>
                    <?php the_post_thumbnail(); ?>
                  <?php } else {?>
                    <img src="<?php echo esc_url(get_template_directory_uri()) ?>/assets/images/post-image.png" alt="<?php echo esc_attr('Post Image', 'archaeology-museums'); ?>">
                  <?php }?>
                  <div class="image-overlay"></div>
                </div>
                <div class="inner-catgory-box px-3">
                  <h3 class="post-heading mt-3 mt-md-0 mt-lg-0 mb-0 text-uppercase"><a href="<?php the_permalink(); ?>"><?php the_title(); ?><span class="screen-reader-text"><?php the_title(); ?></span></a></h3>
                  <p class="post-para pt-2 pt-md-2 pt-lg-3"><?php $archaeology_museums_excerpt = get_the_excerpt(); echo esc_html( archaeology_museums_string_limit_words( $archaeology_museums_excerpt, esc_attr(get_theme_mod('archaeology_museums_services_excerpt_number','20')))); ?></p>
                </div>
              </div>
            </div>
          <?php endwhile;
            wp_reset_postdata();
          }?>
        </div>
      </div>
    </section>
  <?php }?>
  <?php do_action( 'archaeology_museums_after_service' ); ?>

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

<?php get_footer(); ?> 