<?php
/**
 * The Template Name: Home Page
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site will use a
 * different template.
 *
 * @package Classic Corporate
 */

get_header(); ?>

<div id="content" >
  <?php
    $classic_corporate_hidcatslide = get_theme_mod('classic_corporate_hide_categorysec', false);
    $classic_corporate_slidersection = get_theme_mod('classic_corporate_slidersection');

    if ($classic_corporate_hidcatslide && $classic_corporate_slidersection) { ?>
    <section id="slider">
      <div class="main-slider">
        <div class="owl-carousel owl-theme slider-sec">
          <?php if( get_theme_mod('classic_corporate_slidersection',false) ) { ?>
            <?php $classic_corporate_queryvar = new WP_Query('cat='.esc_attr(get_theme_mod('classic_corporate_slidersection',false)));
              while( $classic_corporate_queryvar->have_posts() ) : $classic_corporate_queryvar->the_post(); ?>
            <div class="item">
              <div class="content d-flex align-items-center" style="background-image: url(<?php 
                if (has_post_thumbnail()) {
                  echo the_post_thumbnail_url('full');
                } else {
                  echo esc_url(get_template_directory_uri() . '/images/slider-image.png');
                }
                ?>);">
                <div class="sliderbox">
                  <h1 class="title-slider mb-2 text-md-start text-center">
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                  </h1>
                  <div class="gap-md-3 gap-1 text-start mt-4 sliderbtn">
                    <?php 
                    $classic_corporate_button_text = get_theme_mod('classic_corporate_button_text', 'Read More');
                    $classic_corporate_button_link_slider = get_theme_mod('classic_corporate_button_link_slider', ''); 
                    if (empty($classic_corporate_button_link_slider)) {
                        $classic_corporate_button_link_slider = get_permalink();
                    }
                    if ($classic_corporate_button_text || !empty($classic_corporate_button_link_slider)) { ?>
                      <a href="<?php echo esc_url($classic_corporate_button_link_slider); ?>" class="button redmor">
                        <?php echo esc_html($classic_corporate_button_text); ?>
                          <span class="screen-reader-text"><?php echo esc_html($classic_corporate_button_text); ?></span>
                      </a>
                    <?php } ?>
                  </div>
                </div>
                <div class="overlayer"></div>
              </div>
            </div>
            <?php endwhile; wp_reset_postdata(); ?>
          <?php } ?>
        </div>
      </div>
    </section>
  <?php } ?>

  <?php
    $classic_corporate_hidepageboxes = get_theme_mod('classic_corporate_disabled_pgboxes',false);
    $classic_corporate_about_pageboxes = get_theme_mod('classic_corporate_about_pageboxes');
    if( $classic_corporate_hidepageboxes && $classic_corporate_about_pageboxes){
  ?>
  <div id="about_section" class="my-5 mx-3 mx-md-0">
    <div class="container">
      <div class="row">
        <?php if( get_theme_mod('classic_corporate_about_pageboxes',false)) { ?>
          <?php $classic_corporate_querymed = new WP_query('page_id='.esc_attr(get_theme_mod('classic_corporate_about_pageboxes',false)) ); ?>
            <?php while( $classic_corporate_querymed->have_posts() ) : $classic_corporate_querymed->the_post(); ?>
            <div class="col-lg-6 col-md-6"> 
              <div class="row">
                <div class="col-lg-2 col-md-2 col-2 about-img">
                  <?php if(get_theme_mod('classic_corporate_image_text') != ''){ ?>
                    <div class="image-outerbox">
                      <div class="image-text">
                        <span><?php echo esc_html(get_theme_mod('classic_corporate_image_text')); ?></span>
                      </div>
                    </div>
                  <?php }?>
                </div>
                <div class="col-lg-10 col-md-10 col-10">
                  <?php if (has_post_thumbnail()) { ?>
                    <div class="thumbbx"><?php the_post_thumbnail(); ?></div>
                  <?php } else { ?>
                    <div class="thumbbx no-thumbnail"></div>
                  <?php } ?>
                </div>
              </div>
            </div>
            <div class="col-lg-6 col-md-6 my-3">
              <div class="text-inner-box">
                <?php if( get_theme_mod('classic_corporate_about_title') != '' ){ ?>
                  <p class="abt-title mb-3 text-uppercase">
                    <?php echo esc_html(get_theme_mod('classic_corporate_about_title')); ?>
                  </p>
                <?php }?>
                <?php if( get_theme_mod('classic_corporate_about_heading') != '' ){ ?>
                  <h2 class="abt-head mb-2 text-capitalize">
                    <?php echo esc_html(get_theme_mod('classic_corporate_about_heading')); ?>
                  </h2>
                <div class="vertical-line my-4 ms-5"></div>
                <?php }?>
                <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <p><?php echo esc_html( wp_trim_words( get_the_content(), 60, '...' ) );  ?></p>
                <div class="abt-btn mt-4">
                  <a href="<?php the_permalink(); ?>"><?php esc_html_e('Read More','classic-corporate'); ?></a><span class="screen-reader-text"><?php esc_html_e('Read More','classic-corporate'); ?></span>
                </div>
              </div>
            </div>
          <?php endwhile; wp_reset_postdata(); ?>
        <?php }?>
        <div class="clear"></div>
      </div>
    </div>
  </div>
  <?php }?>

</div>
<?php get_footer(); ?>