<?php
$food_travel_blog_options = food_travel_blog_theme_options();
$main_banner_category = $food_travel_blog_options['main_banner_category'];
?>

<?php
if ($main_banner_category && 'none' != $main_banner_category) {
    $args = [
        'post_type' => 'post',
        'posts_per_page' => 4,
        'post_status' => 'publish',
        'order' => 'desc',
        'orderby' => 'menu_order date',
        'tax_query' => [
            'relation' => 'AND',
            [
                'taxonomy' => 'category',
                'field' => 'slug',
                'terms' => [$main_banner_category],
            ],
        ],
    ];
} else {
    $args = [
        'post_type' => 'post',
        'posts_per_page' => 4,
        'post_status' => 'publish',
        'order' => 'desc',
        'orderby' => 'menu_order date',
    ];
}

$blog_query = new WP_Query($args);
$loop = 0;

if ($blog_query->have_posts()): ?>


<div class="slider-banner ">
    <div class="container">
        <div class="row">
  <div class="slider stick-dots">
  <?php
    while ($blog_query->have_posts()):
    $blog_query->the_post();

    $image_src = wp_get_attachment_image_src(
        get_post_thumbnail_id(),
        'full'
    );
    if($image_src){
        $url = $image_src[0];
        }

    ?>

    <div class="slide">
      <div class="slide__img">
        <img src="<?php echo esc_url($url) ?>" alt="" class="full-image animated" data-animation-in="zoomInImage"/>
      </div>
      <div class="slide__content">
        <div class="slide__content--headings">
           <h2 class="animated" data-animation-in="fadeInRight"><a href="<?php echo esc_url(get_the_permalink()); ?>"><?php the_title(); ?></a></h2>
           <div class="animated" data-animation-in="fadeInRight"><a class="btn btn-default" href="<?php echo esc_url(get_the_permalink()); ?>"><?php esc_html_e(' Read More ', 'food-travel-blog') ?></a></div>
        </div>
      </div>
    </div>

     <?php endwhile;
    wp_reset_postdata();
    ?>

</div>
</div>
  </div>
</div>



<?php endif;
?>