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

$multi_blogger_slider = get_theme_mod( 'multi_blogger_slider_setting', false );
$multi_blogger_slider_button_url  = get_theme_mod( 'multi_blogger_slider_btn_url' );
$multi_blogger_slider_button_text = get_theme_mod( 'multi_blogger_button_text', __( 'Explore more', 'multi-blogger' ) );
?>

<?php if ( $multi_blogger_slider ) { ?>
  <div class="banner-main">
    <div class="test">
      <div class="banner-content">
        <div class="container">
          <!-- Static Text Section -->
          <div class="banner_box">
            <?php if ( get_theme_mod('multi_blogger_slider_banner_heading') ) : ?>
              <h1><?php echo esc_html(get_theme_mod('multi_blogger_slider_banner_heading')); ?></h1>
            <?php endif; ?>
            <?php if ( get_theme_mod('multi_blogger_slider_banner_content') ) : ?>
              <p><?php echo esc_html(get_theme_mod('multi_blogger_slider_banner_content')); ?></p>
            <?php endif; ?>
            <div class="slide-btn-green">
              <?php if ($multi_blogger_slider_button_text ) : ?>
                <a href="<?php echo esc_url( $multi_blogger_slider_button_url ); ?>">
                    <?php echo esc_html( $multi_blogger_slider_button_text ); ?>
                </a>
              <?php endif; ?>
            </div>
          </div>
        </div>
      </div>
      <!-- Owl Carousel -->
      <div class="banner_inner_box_img">
        <div class="owl-carousel">
          <?php 
            $multi_blogger_catergory_name = get_theme_mod('multi_blogger_slider_blog_args_');
            $args = array(
                'post_type'           => 'post',
                'category_name'       => $multi_blogger_catergory_name,
                'orderby'             => 'post__in',
                'ignore_sticky_posts' => true,
            );
            ?>
            <?php
            $loop = new WP_Query($args);
            if ( $loop->have_posts() ) :
                $i=1;
                while ($loop->have_posts()) : $loop->the_post(); ?>
                        <div class="upper-box <?php echo ('catebox-'.$i); ?>">
                            <div class="box wow zoomIn delay-1000" data-wow-duration="2s">
                                <?php
                                    if ( has_post_thumbnail() ) : ?>
                                    <div class="image-blog">
                                      <?php the_post_thumbnail();?>
                                    </div>
                                    <?php else:
                                      ?>
                                      <div class="image-blog">
                                        <img src="<?php echo get_stylesheet_directory_uri() . '/images/default-header.png'; ?>">
                                      </div>
                                      <?php
                                    endif;
                                  ?>
                                  <div class="box-content">
                                    <h4 class="title mb-2"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
                                </div>
                            </div>
                        </div>
                <?php  $i++; endwhile;
            endif;
          ?>
        </div>
      </div>
    </div>
  </div>
<?php } ?>
