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

$designer_dresses_slider = get_theme_mod( 'designer_dresses_slider_setting',false );
$designer_dresses_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('designer_dresses_blog_slide_category'),
  'posts_per_page' => 3,
); ?>

<?php if ( $designer_dresses_slider ){?>
<div class="slider-back">
  <div class="banner-main">
    <?php if ( get_theme_mod('designer_dresses_slider_background_image') ) : ?>
      <img class="inner-banner" src="<?php echo esc_url(get_theme_mod('designer_dresses_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 $designer_dresses_arr_posts = new WP_Query( $designer_dresses_args );
        if ( $designer_dresses_arr_posts->have_posts() ) :
          while ( $designer_dresses_arr_posts->have_posts() ) :
            $designer_dresses_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">
                    <div class="banner_box wow bounceInDown" data-wow-duration="2s">
                        <?php if ( get_theme_mod('designer_dresses_slider_text_extra') ) : ?>
                          <h5><?php echo esc_html(get_theme_mod('designer_dresses_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('Discover More', 'designer-dresses'); ?></a>
                        </p>
                    </div>
                </div>
                <div class="col-lg-5 col-md-12 col-12 align-self-center banner_inner_box_img position-relative wow zoomIn" 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 class="discount-text">
                    <?php if(get_theme_mod('designer_dresses_discount_text') != ''){ ?>
                        <p class="discount1 mb-0"><?php echo esc_html(get_theme_mod ('designer_dresses_discount_text','designer-dresses')); ?></p>
                        <p class="discount2 mb-0"><?php echo esc_html('Discount','designer-dresses'); ?></p>
                    <?php } ?>
                </div>
                </div>
              </div>
              </div>
            </div>
          <?php
        endwhile;
        wp_reset_postdata();
        endif; ?>
      </div>
    </div>
  </div>
</div>
<?php } ?>