'popular-news', 'description' => esc_html__( 'Add Widget to Display Popular News.', 'bulletin-news' ) ); parent::__construct( 'Bulletin_News_Popular_News',esc_html__( 'BN: Popular News', 'bulletin-news' ), $widget_popular, $control_ops ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'section_title' => esc_html__( 'Popular News', 'bulletin-news' ), 'section_category' => '', 'no_of_posts' => 5, 'show_category' => true, ) ); $Section_title = isset( $instance['section_title'] ) ? esc_html( $instance['section_title'] ) : esc_html__( 'Popular News', 'bulletin-news' ); $section_category = isset( $instance['section_category'] ) ? absint( $instance['section_category'] ) : 0; $no_of_posts = isset( $instance['no_of_posts'] ) ? absint( $instance['no_of_posts'] ) : 5; $show_category = isset( $instance['show_category'] ) ? (bool) $instance['show_category'] : true; ?>

'', 'class' => 'widefat', 'show_option_all' => esc_html__('Latest News','bulletin-news'), 'name' => esc_attr($this->get_field_name( 'section_category' )), 'selected' => absint( $section_category ), ) ); ?>

id_base ); $section_category = isset( $instance[ 'section_category' ] ) ? $instance[ 'section_category' ] : 0; $no_of_posts = ( ! empty( $instance['no_of_posts'] ) ) ? absint( $instance['no_of_posts'] ) : 5; $show_category = isset( $instance['show_category'] ) ? $instance['show_category'] : true; echo $before_widget; ?> absint( $no_of_posts ), 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => get_option( 'sticky_posts' ), ); if ( absint( $section_category ) > 0 ) { $popular_news_args['cat'] = absint( $section_category ); } $the_loop = new WP_Query( $popular_news_args ); if ( $the_loop -> have_posts() ) : $i = 1; $count = count( ( array ) $the_loop ); ?>