<?php $automobile_rental_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('automobile_rental_blog_slide_category'),
  'posts_per_page' => get_theme_mod('automobile_rental_blog_slide_number'),
); ?>

<?php if ( get_theme_mod('automobile_rental_blog_box_enable',true) ) : ?>
  <div class="slider">
    <div class="slider-box">
      <div class="slider-inner-banner">
          <div class="owl-carousel">
            <?php $automobile_rental_arr_posts = new WP_Query( $automobile_rental_args );
            $i = 1;
            if ( $automobile_rental_arr_posts->have_posts() ) :
              while ( $automobile_rental_arr_posts->have_posts() ) :
                $automobile_rental_arr_posts->the_post();
                ?>
                <div class="slider-box">
                  <div class="slider-image">
                    <?php
                      if ( has_post_thumbnail() ) :
                        the_post_thumbnail();
                      else:
                        ?>
                        <div class="slider-alternate">
                          <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/header-banner.png'; ?>">
                        </div>
                        <?php
                      endif;
                    ?>
                  </div>
                  <div class="slider-owl-position wow zoomIn">
                    <h3 class="mb-3"><?php the_title(); ?></h3>
                    <p class="mb-4 pb-2 content"><?php echo wp_trim_words(get_the_content(), 20); ?></p>
                    <div class="slider-button mb-0">
                      <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('Explore More','automobile-rental'); ?></a>
                    </div>
                  </div>
                </div>
              <?php
              $i++;
            endwhile;
            wp_reset_postdata();
            endif; ?>
          </div>
          <?php if(get_theme_mod('automobile_rental_contact_form_shortcode')){ ?>
            <div class="form-box">
              <?php echo do_shortcode(get_theme_mod('automobile_rental_contact_form_shortcode')); ?>
            </div>
          <?php }?>
      </div>
    </div>
  </div>
<?php endif; ?>