id_base ); // Get the number of posts to display and set default to 5 if not provided or invalid $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; // Query recent posts using WP_Query and apply filters to the arguments $graceful_rcnt = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, ) ) ); // Define allowed HTML tags for widget output $graceful_allowed_htm = array( 'section' => array( 'class' => array(), 'id' => array(), ), 'h2' => array() ); // Output the widget content if there are recent posts if ( $graceful_rcnt->have_posts() ) { // Start the widget container echo wp_kses( $before_widget, $graceful_allowed_htm ); // Output the widget title if ( $graceful_title ) { echo wp_kses( $before_title, $graceful_allowed_htm ) . esc_html( $graceful_title ) . wp_kses( $after_title, $graceful_allowed_htm ); } ?>