'widget popular-posts', 'description' => esc_html__( 'Display Popular Style Widget.', 'buzz-magazine' ), 'customize_selective_refresh' => true, ); parent::__construct( 'buzz_magazine_popular', esc_html__( 'Buzz Magazine Sidebar: Popular', 'buzz-magazine' ), $widget_ops, $control_ops ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => esc_html__( 'Popular', 'buzz-magazine' ), 'category' => '', 'number' => 4, 'show_post_meta' => true, 'display_category' => true, 'display_content' => true, ) ); $title = isset( $instance['title'] ) ? esc_html( $instance['title'] ) : esc_html__( 'Feature Slider', 'buzz-magazine' ); $category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 4; $display_category = isset( $instance['display_category'] ) ? (bool) $instance['display_category'] : true; $show_post_meta = isset( $instance['show_post_meta'] ) ? (bool) $instance['show_post_meta'] : true; $display_content = isset( $instance['display_content'] ) ? (bool) $instance['display_content'] : true; ?>

'widefat', 'show_option_all' => esc_html__('From Recent Post','buzz-magazine'), 'name' => esc_attr($this->get_field_name( 'category' )), 'selected' => absint( $category ), ) ); ?>

id="get_field_id( 'display_category' )); ?>" name="get_field_name( 'display_category' )); ?>" />

id="get_field_id( 'show_post_meta' )); ?>" name="get_field_name( 'show_post_meta' )); ?>" />

id="get_field_id( 'display_content' )); ?>" name="get_field_name( 'display_content' )); ?>" />

id_base ); $category = isset( $instance[ 'category' ] ) ? $instance[ 'category' ] : 0; $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 4; $show_post_meta = isset( $instance['show_post_meta'] ) ? $instance['show_post_meta'] : true; $display_category = isset( $instance['display_category'] ) ? $instance['display_category'] : true; $display_content = isset( $instance['display_content'] ) ? $instance['display_content'] : true; echo $before_widget; ?>

absint( $number ), 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'comment_count', 'post__not_in' => get_option( 'sticky_posts' ), ); if ( absint( $category ) > 0 ) { $args['cat'] = absint( $category ); } $query_popular_posts = new WP_Query( $args ); if ($query_popular_posts->have_posts()) : $count= 0; while ( $query_popular_posts->have_posts() ) : $query_popular_posts->the_post(); $count++; ?>