'popular-news', 'description' => esc_html__( 'Add Widget to Display Popular Posts.', 'akisa' ) ); parent::__construct( 'Akisa_Latest_News',esc_html__( 'St: Popular Posts', 'akisa' ), $widget_popular, $control_ops ); } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => esc_html__( 'Popular Posts', 'akisa' ), 'category' => '', 'number' => 6, 'show_category' => true, ) ); $title = isset( $instance['title'] ) ? esc_html( $instance['title'] ) : esc_html__( 'Popular Posts', 'akisa' ); $category = isset( $instance['category'] ) ? absint( $instance['category'] ) : 0; $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 6; $show_category = isset( $instance['show_category'] ) ? (bool) $instance['show_category'] : true; ?>
'', 'class' => 'widefat', 'show_option_all' => esc_html__('Popular Posts','akisa'), 'name' => esc_attr($this->get_field_name( 'category' )), 'selected' => absint( $category ), ) ); ?>
id_base ); $category = isset( $instance[ 'category' ] ) ? $instance[ 'category' ] : 0; $featured_category = isset( $instance[ 'featured_category' ] ) ? $instance[ 'featured_category' ] : 0; $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 6; $show_category = isset( $instance['show_category'] ) ? $instance['show_category'] : true; echo $before_widget; ?> absint( $number ), 'post_type' => 'post', 'post_status' => 'publish', 'post__not_in' => get_option( 'sticky_posts' ), ); if ( absint( $category ) > 0 ) { $popular_news_args['cat'] = absint( $category ); } $the_loop = new WP_Query( $popular_news_args ); if ( $the_loop -> have_posts() ) : $i = 1; $count = count( ( array ) $the_loop ); ?>