<?php

if ( get_theme_mod( 'slider_display', $default = true ) ) {
    ?>
  <!-- banner-news -->
  <?php 
    $category_id = get_theme_mod( 'slider_category', '' );
    $title = get_theme_mod( 'slider_title', '' );
    $number_of_posts = get_theme_mod( 'slider_number_of_posts', 3 );
    $post_details = get_theme_mod( 'slider_details_show_hide', array(
        'date',
        'categories',
        'summary',
        'readmore'
    ) );
    $category_args = array(
        'posts_per_page' => $number_of_posts,
    );
    if ( !empty( $category_id ) ) {
        $category_args['cat'] = $category_id;
    }
    $query = new WP_Query($category_args);
    set_query_var( 'query', $query );
    set_query_var( 'title', $title );
    set_query_var( 'post_details', $post_details );
    ?>

  <?php 
    if ( $query->have_posts() ) {
        ?>

    <?php 
        get_template_part( 'layouts/slider/slider-layout-one' );
        ?>
  <?php 
    }
    ?>
  <!-- banner-news -->

  <style>
    /* no bootstrap clas */
    .banner-news section {
      margin: -1px;
    }

    .banner-news .banner-news-list img {
      width: 100%;
      height: 200px;
    }

    .banner-news .banner-news-list:nth-child(1) {
      /* float: left; */
      width: 67%;
    }

    .banner-news .banner-news-list:nth-child(1) img {
      height: 401px;
    }

    .banner-news .banner-news-caption h1 {
      padding: 7px 0;
    }

    .banner-news-slider .banner-news-list:nth-child(1) {
      width: 100%;
      padding: 0;
    }

    .banner-news-slider .banner-news-list:nth-child(1) img {
      height: auto;
    }

    .owl-prev,
    .owl-next {
      background-color: var(--primary-color) !important;
    }
  </style>
<?php 
}