'post', 'posts_per_page' => ! empty( $number_of_posts ) ? absint( $number_of_posts ) : 3, 'order' => 'DESC', 'ignore_sticky_posts' => true, 'category__in' => $featured_posts_category, ) ); if ( ! $post->have_posts() ) { return; } /** * Index of the current post that is showed in loop. */ $item_index = 0; /** * The total number of posts. */ $category = get_category( $featured_posts_category[0] ); $total_posts = $category->category_count; echo ''; } /** * Filter main loop posts for featured area exclusion. * * @param array $posts the posts array. * * @return array */ public function remove_featured_posts_in_main_loop( $posts ) { return array_merge( $posts, $this->posts_to_skip ); } /** * Based on the post index, decide if the post should display full width or just 50% of the page. * * @param int $index Post index. * @param int $total_posts Number of posts in category. * * @return string */ private function get_card_class( $index, $total_posts ) { if ( $total_posts > 1 ) { if ( $index % 3 === 1 ) { return 'col-md-6'; } if ( $index % 3 === 2 ) { return 'col-md-6'; } return 'col-md-12'; } } /** * Featured posts wrapper class. * * @return string */ private function wrapper_class() { $default = hestia_get_blog_layout_default(); $blog_sidebar_layout = apply_filters( 'hestia_sidebar_layout', get_theme_mod( 'hestia_blog_sidebar_layout', $default ) ); if ( $blog_sidebar_layout === 'full-width' || ( ! is_active_sidebar( 'sidebar-1' ) && ! is_customize_preview() ) ) { return ' col-md-10 col-md-offset-1 '; } else { return ' col-md-12 '; } } }