<?php if ( get_theme_mod('real_esatate_property_your_properties_enable',false) ) : ?>

<?php $real_esatate_property_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('real_esatate_property_your_properties_category'),
  'posts_per_page' => get_theme_mod('real_esatate_property_your_properties_number'),
); ?>

<div class="properties pt-5">
  <div class="container">
    <div class="row mb-5">
      <div class="col-lg-9 col-md-8 col-sm-8 align-self-center text-center text-md-start">
        <?php if ( get_theme_mod('real_esatate_property_section_title') ) : ?>
          <h3 class="wow fadeInLeft"><?php echo esc_html( get_theme_mod('real_esatate_property_section_title' ) ); ?></h3>
        <?php endif; ?>
        <?php if ( get_theme_mod('real_esatate_property_section_text') ) : ?>
          <p class="mb-0 wow fadeInLeft"><?php echo esc_html( get_theme_mod('real_esatate_property_section_text' ) ); ?></p>
        <?php endif; ?>
      </div>
      <div class="col-lg-3 col-md-4 col-sm-4 align-self-center wow fadeInRight">
        <?php if ( get_theme_mod('real_esatate_property_section_btn_link') || get_theme_mod('real_esatate_property_section_btn_text') ) : ?>
          <p class="mb-0 my-4 my-md-0 text-center text-md-end property-sec-btn"><a href="<?php echo esc_html( get_theme_mod('real_esatate_property_section_btn_link' ) ); ?>"><?php echo esc_html( get_theme_mod('real_esatate_property_section_btn_text' ) ); ?></a></p>
        <?php endif; ?>
      </div>
    </div>
    <div class="owl-carousel">
      <?php $real_esatate_property_arr_posts = new WP_Query( $real_esatate_property_args );
      if ( $real_esatate_property_arr_posts->have_posts() ) :
        while ( $real_esatate_property_arr_posts->have_posts() ) :
          $real_esatate_property_arr_posts->the_post();
          ?>
          <div class="property-main-box wow zoomIn">
            <?php
            if ( has_post_thumbnail() ) :
              the_post_thumbnail();
            else:
              ?>
              <div class="slider-alternate">
                <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/banner.png'; ?>">
              </div>
              <?php
            endif;
          ?>
            <div class="property-inner-box p-2">
              <h4 class="mb-0"><a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php the_title(); ?></a></h4>
              <?php if( get_post_meta($post->ID, 'real_esatate_property_your_properties_count', true) ) {?>
                <p class="mb-0"><?php echo esc_html(get_post_meta($post->ID,'real_esatate_property_your_properties_count',true)); ?> <?php esc_html_e('Properties','real-esatate-property'); ?></p>
              <?php }?>
            </div>
          </div>
        <?php
      endwhile;
      wp_reset_postdata();
      endif; ?>
    </div>
  </div>
</div>

<?php endif; ?>
