<?php
/**
 * Banner Section
 * 
 * @package kids_toy_center
 */
$kids_toy_center_slider     = get_theme_mod( 'kids_toy_center_slider_setting',true );

$kids_toy_center_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('kids_toy_center_blog_slide_category'),
  'posts_per_page' => 3,
); ?>
<?php if ( $kids_toy_center_slider ){?>
  <div class="banner">
    <div class="owl-carousel">
      <?php $kids_toy_center_arr_posts = new WP_Query( $kids_toy_center_args );
      if ( $kids_toy_center_arr_posts->have_posts() ) :
        while ( $kids_toy_center_arr_posts->have_posts() ) :
          $kids_toy_center_arr_posts->the_post();
          ?>
          <div class="banner_inner_box">
            <?php
              if ( has_post_thumbnail() ) :
                the_post_thumbnail();
              else:
                ?>
                <div class="image-container">
                  <img src="<?php echo get_stylesheet_directory_uri() . '/images/slider.jpg'; ?>">
                </div>
                <?php
              endif;
            ?>
              <div class="banner_box wow zoomIn" data-wow-duration="2s">
                  <h2 class="my-3"><?php the_title(); ?></a></h2>
                  <p class="mb-0"><?php echo wp_trim_words( get_the_content(), 30 ); ?></p>
                  <div class="slider-buttons">
                      <p class="btn-green mt-4">
                        <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('Contact Us','kids-toy-center'); ?></a>
                      </p>
                </div>
              </div>
          </div>
        <?php
      endwhile;
      wp_reset_postdata();
      endif; ?>
    </div>
  </div>
<?php } ?>