esc_html__('This Widget show Category Posts From Multiple Category.', 'allrounder-news') ) ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $allrounder_news_Category_list = allrounder_news_Category_list($select = false); $fields = array( 'allrounder_news_blog_cat_category' => array( 'allrounder_news_widgets_name' => 'allrounder_news_blog_cat_category', 'allrounder_news_widgets_title' => esc_html__('Select Post Categories', 'allrounder-news'), 'allrounder_news_widgets_field_type' => 'multicheckboxes', 'allrounder_news_widgets_field_options' => $allrounder_news_Category_list ), 'allrounder_news_blog_posts' => array( 'allrounder_news_widgets_name' => 'allrounder_news_blog_posts', 'allrounder_news_widgets_title' => esc_html__('Posts Per Page', 'allrounder-news'), 'allrounder_news_widgets_field_type' => 'number', ), ); return $fields; } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { extract($args); $allrounder_news_blog_cat_categories = isset( $instance['allrounder_news_blog_cat_category'] ) ? $instance['allrounder_news_blog_cat_category'] : '' ; $allrounder_news_blog_posts = isset( $instance['allrounder_news_blog_posts'] ) ? $instance['allrounder_news_blog_posts'] : '5' ; if( empty( $allrounder_news_blog_posts ) ){ $allrounder_news_blog_posts = 5; } echo $before_widget; if( $allrounder_news_blog_cat_categories ){ ?>