<?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 Landscape Architecture
 */

get_header(); ?>

<div id="content" >
  <?php
    $landscape_architecture_hidcatslide = get_theme_mod('landscape_architecture_hide_categorysec', false);
    $landscape_architecture_slidersection = get_theme_mod('landscape_architecture_slidersection');

    if ($landscape_architecture_hidcatslide && $landscape_architecture_slidersection) { ?>
    <section id="slider">
      <div class="main-slider">
        <div class="owl-carousel owl-theme slider-sec">
          <?php if( get_theme_mod('landscape_architecture_slidersection',false) ) { ?>
            <?php $landscape_architecture_queryvar = new WP_Query('cat='.esc_attr(get_theme_mod('landscape_architecture_slidersection',false)));
              while( $landscape_architecture_queryvar->have_posts() ) : $landscape_architecture_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 
                    $landscape_architecture_button_text = get_theme_mod('landscape_architecture_button_text', 'Read More');
                    $landscape_architecture_button_link_slider = get_theme_mod('landscape_architecture_button_link_slider', ''); 
                    if (empty($landscape_architecture_button_link_slider)) {
                        $landscape_architecture_button_link_slider = get_permalink();
                    }
                    if ($landscape_architecture_button_text || !empty($landscape_architecture_button_link_slider)) { ?>
                      <?php if(get_theme_mod('landscape_architecture_button_text', 'Read More') != ''){ ?>
                        <a href="<?php echo esc_url($landscape_architecture_button_link_slider); ?>" class="button redmor">
                          <?php echo esc_html($landscape_architecture_button_text); ?>
                            <span class="screen-reader-text"><?php echo esc_html($landscape_architecture_button_text); ?></span>
                        </a>
                      <?php } ?>
                    <?php } ?>
                  </div>
                </div>
                <div class="overlayer"></div>
              </div>
            </div>
            <?php endwhile; wp_reset_postdata(); ?>
          <?php } ?>
        </div>
      </div>
    </section>
  <?php } ?>

  <?php
    $landscape_architecture_hidepageboxes = get_theme_mod('landscape_architecture_disabled_pgboxes',true);
    $landscape_architecture_blog_cat = get_theme_mod('landscape_architecture_blog_cat');
    if( $landscape_architecture_hidepageboxes && $landscape_architecture_blog_cat){
  ?>
  <section id="blog" class="my-5">
    <div class="container">
      <div class="blog_bx mx-lg-5 px-lg-5 text-center">
        <?php if ( get_theme_mod('landscape_architecture_headingtext1') != "") { ?>
          <h2 class="subhed mb-3"><?php echo esc_html(get_theme_mod('landscape_architecture_headingtext1','landscape-architecture')); ?></h2>
        <?php }?>
        <?php if ( get_theme_mod('landscape_architecture_headingtext_para') != "") { ?>
          <h3 class="mb-3"><?php echo esc_html(get_theme_mod('landscape_architecture_headingtext_para','landscape-architecture')); ?></h3>
        <?php }?>
      </div>
      <div class="row">
        <?php if( get_theme_mod('landscape_architecture_blog_cat') ) { ?>

        <?php $landscape_architecture_queryvar = new WP_Query(
          array( 
            'cat' => esc_attr(get_theme_mod('landscape_architecture_blog_cat')),
            'posts_per_page' => esc_attr(get_theme_mod('landscape_architecture_blog_count',3))
          )
        );
        while( $landscape_architecture_queryvar->have_posts() ) : $landscape_architecture_queryvar->the_post(); ?>
        <div class="col-lg-4 col-md-6 service-box my-3">
          <?php the_post_thumbnail( 'full' ); ?>
          <div class="blog-content<?php if (!has_post_thumbnail()) echo ' no-thumbnail'; ?>">
            <div class="row">
              <div class="col-lg-2 col-md-2 col-2 align-self-center">
                <?php if( get_post_meta(get_the_ID(), 'landscape_architecture_custom_icon', true) ) {?>
                  <div class="meta-feilds text-center">
                    <?php if( get_post_meta($post->ID, 'landscape_architecture_custom_icon', true) ) {?>
                      <i class="<?php echo esc_html(get_post_meta($post->ID, 'landscape_architecture_custom_icon', true)); ?>"></i>
                    <?php }?>
                  </div>
                <?php }?>
              </div>
              <div class="col-lg-10 col-md-10 col-10 align-self-center">
                <h4 class="fw-bolder my-0"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
              </div>
            </div>
          </div>
        </div>
        <?php endwhile; wp_reset_postdata(); ?>
        <?php } ?>
      </div>
    </div>
  </section>
  <?php }?>

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