'post', 'posts_per_page' => absint($no_of_popular_posts), 'post_status' => 'publish', 'no_found_rows' => 1, 'ignore_sticky_posts' => 1, 'orderby' => esc_attr($popular_post_orderby), 'order' => esc_attr($popular_post_order), ); // Check for category. if (!empty($popular_post_cat)) : $post_args['tax_query'] = array( array( 'taxonomy' => 'category', 'field' => 'term_id', 'terms' => $popular_post_cat, ), ); endif; $popular_posts = new WP_Query($post_args); if ($popular_posts->have_posts()) : $column = blogbull_get_option( 'popular_post_column', 3 ); $autoplay = blogbull_get_option( 'enable_popular_post_autoplay' ); $arrows = blogbull_get_option( 'enable_popular_post_arrows', true ); $dots = blogbull_get_option( 'enable_popular_post_dots' ); $margin = 20; // Build attributes. $data_slider = array(); $data_slider['spaceBetween'] = $margin; $data_slider['loop'] = true; if ( $arrows ) : $data_slider['navigation'] = array( 'nextEl' => '.wpi-popular-section .swiper-button-next', 'prevEl' => '.wpi-popular-section .swiper-button-prev', ); endif; if ( $dots ) : $data_slider['pagination'] = array( 'el' => '.wpi-popular-section .swiper-pagination', 'clickable' => true, ); endif; if ( $autoplay ) : $data_slider['autoplay'] = array( 'delay' => 5000, ); endif; if ( $column == 2 ) { $data_slider['breakpoints'] = array( '768' => array( 'slidesPerView' => 2, ), ); } elseif ( $column == 3 ) { $data_slider['breakpoints'] = array( '768' => array( 'slidesPerView' => 2, ), '992' => array( 'slidesPerView' => 3, 'centeredSlides' => true, ), ); } elseif ( $column == 4 ) { $data_slider['breakpoints'] = array( '768' => array( 'slidesPerView' => 2, ), '992' => array( 'slidesPerView' => 3, ), '1024' => array( 'slidesPerView' => 4, 'centeredSlides' => true, ), ); } elseif ( $column == 5 ) { $data_slider['breakpoints'] = array( '768' => array( 'slidesPerView' => 2, ), '992' => array( 'slidesPerView' => 3, ), '1024' => array( 'slidesPerView' => 4, ), '1200' => array( 'slidesPerView' => 5, 'centeredSlides' => true, ), ); } ?>