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

$shoes_footwear_slider = get_theme_mod( 'shoes_footwear_slider_setting', false );
$shoes_footwear_args   = array(
  'post_type'      => 'post',
  'post_status'    => 'publish',
  'category_name'  => get_theme_mod( 'shoes_footwear_blog_slide_category' ),
  'posts_per_page' => 6,
); ?>

<?php if ( $shoes_footwear_slider ) { ?>
  <div class="banner-main">
    <div class="test">
        <div class="container">
            <div class="owl-carousel banner-slider">
                <?php
                $shoes_footwear_arr_posts = new WP_Query( $shoes_footwear_args );
                if ( $shoes_footwear_arr_posts->have_posts() ) :
                    while ( $shoes_footwear_arr_posts->have_posts() ) :
                        $shoes_footwear_arr_posts->the_post();
                ?>
                <div class="item">
                    <div class="row align-items-center">
                        <div class="col-lg-6 col-md-12">
                            <div class="banner_box">
                                <div class="img-content">
                                    <?php if ( get_theme_mod( 'shoes_footwear_slider_text_extra' ) ) : ?>
                                        <p class="extra-content"><?php echo esc_html( get_theme_mod( 'shoes_footwear_slider_text_extra' ) ); ?></h5>
                                    <?php endif; ?>
                                    <h3>
                                        <a href="<?php the_permalink(); ?>">
                                            <?php the_title(); ?>
                                        </a>
                                    </h3>
                                    <p class="mb-0">
                                        <?php echo wp_trim_words( get_the_content(), 50 ); ?>
                                    </p>
                                </div>
                                <?php if ( get_theme_mod( 'shoes_footwear_slider_btn_text' ) ) : ?>
                                    <div class="slide-btn-green mt-3">
                                        <a href="<?php echo esc_url( get_theme_mod( 'shoes_footwear_slider_btn_url' ) ); ?>">
                                            <?php echo esc_html( get_theme_mod( 'shoes_footwear_slider_btn_text' ) ); ?>
                                        </a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-12 banner_inner_box_img position-relative p-0">
                            <div class="single-slide position-relative wow zoomIn" data-wow-duration="2s">
                                <?php if (has_post_thumbnail()): ?>
                                    <?php the_post_thumbnail(); ?>
                                <?php else: ?>
                                    <div class="banner_inner_box">
                                        <img src="<?php echo esc_url( get_stylesheet_directory_uri() . '/images/default.png' ); ?>" alt="<?php esc_attr_e( 'Default Image', 'shoes-footwear' ); ?>">
                                    </div>
                                <?php endif; ?>
                            </div>
                            <?php if ( get_theme_mod( 'shoes_footwear_slider_short_title' ) ) : ?>
                                <h1 class="extra-title"><?php echo esc_html( get_theme_mod( 'shoes_footwear_slider_short_title' ) ); ?></h5>
                            <?php endif; ?>
                            <?php if ( get_theme_mod( 'shoes_footwear_slider_second_short_title' ) ) : ?>
                                <h1 class="extra-second-title"><?php echo esc_html( get_theme_mod( 'shoes_footwear_slider_second_short_title' ) ); ?></h5>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <?php
                    endwhile;
                    wp_reset_postdata();
                endif;
                ?>
            </div>
        </div>
    </div>
  </div>
<?php } ?>