esc_html__( 'Display Post List Layout.', 'buzznews' ), ) // Args ); } /** * Widget Form Section */ public function form( $instance ) { $defaults = array( 'title' => esc_html__( 'Post List view', 'buzznews' ), 'category' => esc_html__( 'all', 'buzznews' ), 'number_posts' => 8, ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

$this->get_field_name('category'), 'selected' => $instance['category'], 'show_option_all' => esc_html__('Show all posts','buzznews' ), 'class' => 'widefat' ) ); ?>

id_base ); $home_blog_category_id = ( ! empty( $instance['category'] ) ) ? absint( $instance['category'] ) : ''; $number_posts = ( ! empty( $instance['number_posts'] ) ) ? absint( $instance['number_posts'] ) : 6; // last post count if( $home_blog_category_id != '' ){ $category = get_category($home_blog_category_id); $last_page_count = ( $category->category_count ) / $number_posts; }else{ $last_page_count = intval( buzznews_get_total_posts() / $number_posts ) + 1; } // Latest Posts echo wp_kses_post( $before_widget ); ?>
'post','posts_per_page'=>$number_posts,'cat'=>$home_blog_category_id ); $blog_query = new WP_Query( $args ); ?>
have_posts()) : while( $blog_query->have_posts()): $blog_query->the_post(); /* * Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'spiderbuzz/template-parts/content', get_post_format() ); endwhile; wp_reset_postdata(); endif; ?>