esc_html__( 'Display posts from a category', 'blogrow' ), 'classname' => 'widget_blogrow_posts', 'customize_selective_refresh' => true ) ); } public function blogrow_get_defaults() { return array( 'title' => '', // Posts 'posts_thumb' => 1, 'posts_category'=> 1, 'posts_date' => 1, 'posts_num' => '4', 'posts_cat_id' => '0', 'posts_orderby' => 'date', 'posts_time' => '0', ); } /* Widget /* ------------------------------------ */ public function widget($args, $instance) { extract( $args ); $defaults = $this -> blogrow_get_defaults(); $instance = wp_parse_args( (array) $instance, $defaults ); $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); $output = $before_widget."\n"; if($title) $output .= $before_title.$title.$after_title; ob_start(); ?> array( 'post' ), 'showposts' => absint( $instance['posts_num'] ), 'cat' => absint( $instance['posts_cat_id'] ), 'ignore_sticky_posts' => true, 'orderby' => esc_attr( $instance['posts_orderby'] ), 'order' => 'dsc', 'date_query' => array( array( 'after' => esc_attr( $instance['posts_time'] ), ), ), ) ); ?>