fields = array( 'bizlight_pwt_title'=>array( 'label' => esc_html__( 'Title', 'bizlight' ), 'type' => 'text', 'default' => '' ), 'bizlight_pwt_number_of_post' => array( 'label' => esc_html__( 'Number of post', 'bizlight' ), 'type' => 'number', 'default' => 4 ), 'bizlight_pwt_show_excerpt' => array( 'label' => esc_html__( 'Show Excerpt', 'bizlight' ), 'type' => 'checkbox', 'default' => true ) ); } /** * Markup for widget */ public function widget( $args, $instance ){ echo $args[ 'before_widget' ]; $instance = $this->init_defaults( $instance ); $recent_posts = wp_get_recent_posts(array( 'numberposts' => $instance[ 'bizlight_pwt_number_of_post' ], 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'ID' )); if( !empty( $recent_posts ) ){ ?>