<?php
/**
 * Template part for displaying slider section
 *
 * @package Modern Furniture Store
 * @subpackage modern_furniture_store
 */

?>
<?php $modern_furniture_store_static_image = get_stylesheet_directory_uri() . '/assets/images/post-img1.png'; ?>
<?php if( get_theme_mod( 'modern_furniture_store_slider_arrows', true) != '') { ?>
<section id="slider">
    <div class="owl-carousel">
      <?php
        $modern_furniture_store_slider_category=  get_theme_mod('modern_furniture_store_post_setting');if($modern_furniture_store_slider_category){
        $modern_furniture_store_page_query = new WP_Query(array( 'category_name' => esc_html($modern_furniture_store_slider_category ,'modern-furniture-store')));?>
          <?php while( $modern_furniture_store_page_query->have_posts() ) : $modern_furniture_store_page_query->the_post(); ?>
          <div class="slide-box">
            <div class="row">
              <div class="col-lg-6 col-md-6 align-self-center slider-content-col">
                <div class="slide-inner-box">
                  <?php if (get_theme_mod('modern_furniture_store_show_slider_title', true)) : ?>
                  <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                  <?php endif; ?>
                  <?php if (get_theme_mod('modern_furniture_store_show_slider_content', true)) : ?>
                    <p><?php echo wp_trim_words( get_the_content(),20 );?></p>
                  <?php endif; ?>
                    <div class="home-btn py-4">
                      <a href="<?php the_permalink(); ?>"><?php esc_html_e('View All','modern-furniture-store'); ?></a>
                    </div>
                </div>
              </div>
              <div class="col-lg-6 col-md-6 align-self-center slider-img-box">
                <div class="imgbox">
                  <?php if(has_post_thumbnail()){ ?>
                  <img src="<?php echo (the_post_thumbnail_url('full')); ?>"/>
                   <?php }else {echo ('<img src="'.$modern_furniture_store_static_image.'">'); } ?>
                </div>
              </div>
            </div>
          </div>
          <?php endwhile;
        wp_reset_postdata();
      }?>
    </div>
  </section>
<?php } ?>