<?php
/**
 * Banner Section
 * 
 * @package house_rental
 */

$house_rental_slider = get_theme_mod( 'house_rental_slider_setting',false );
$house_rental_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('house_rental_blog_slide_category'),
  'posts_per_page' => 3,
); ?>

<?php if ( $house_rental_slider ){?>
<div class="slider-back">
  <div class="banner-main">
    <?php if ( get_theme_mod('house_rental_slider_background_image') ) : ?>
      <img class="inner-banner" src="<?php echo esc_url(get_theme_mod('house_rental_slider_background_image'));?>">
    <?php else: ?>
      <div class="inner-banner">
        <img src="<?php echo get_stylesheet_directory_uri() . '/images/slide.png'; ?>">
      </div>
    <?php endif; ?>
    <div class="test">
      <div class="owl-carousel">
        <?php $house_rental_arr_posts = new WP_Query( $house_rental_args );
        if ( $house_rental_arr_posts->have_posts() ) :
          while ( $house_rental_arr_posts->have_posts() ) :
            $house_rental_arr_posts->the_post();
            ?>
            <div class="banner_inner_box">
              <div class="container">
                <div class="row">
                <div class="col-lg-7 col-md-12 col-12 align-self-center wow bounceInDown" data-wow-duration="2s">
                    <div class="banner_box">
                        <?php if ( get_theme_mod('house_rental_slider_text_extra') ) : ?>
                          <h5><?php echo esc_html(get_theme_mod('house_rental_slider_text_extra'));?></h5>
                        <?php endif; ?>
                        <h3 class="my-3"><?php the_title(); ?></h3>
                        <p class="mb-0"><?php echo wp_trim_words(get_the_content(), 20); ?></p>
                        <p class="btn-green mt-4">
                            <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('Sell Property', 'house-rental'); ?></a>
                        </p>
                    </div>
                </div>
                <div class="col-lg-5 col-md-12 col-12 align-self-center banner_inner_box_img ss position-relative p-0 wow zoomInUp" data-wow-duration="2s">
                  <?php
                    if ( has_post_thumbnail() ) :
                      the_post_thumbnail();
                    else:
                      ?>
                      <div class="banner_inner_box_img">
                        <img src="<?php echo get_stylesheet_directory_uri() . '/images/default-header.png'; ?>">
                      </div>
                      <?php
                    endif;
                  ?>
                </div>
              </div>
              </div>
            </div>
          <?php
        endwhile;
        wp_reset_postdata();
        endif; ?>
      </div>
    </div>
  </div>
</div>
<?php } ?>