'widget-oceanwp-recent-posts recent-posts-widget', 'description' => esc_html__( 'Shows a listing of your recent or random posts.', 'ocean-extra' ), 'customize_selective_refresh' => true, ) ); $this->defaults = array( 'title' => esc_html__( 'Recent Posts', 'ocean-extra' ), 'number' => '3', 'post_type' => 'post', 'taxonomy' => '', 'terms' => '', 'order' => 'DESC', 'orderby' => 'date', ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * @since 1.0.0 * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { // Parse instance extract( wp_parse_args( $instance, $this->defaults ) ); // Apply filters to the title $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : ''; // Before widget WP hook echo $args['before_widget']; // Show widget title if ( $title ) { echo $args['before_title'] . esc_html( $title ) . $args['after_title']; } ?> defaults ) ); ?>