'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 ) { $new_instance = wp_parse_args( $instance, $this->defaults ); $title = ! empty( $new_instance['title'] ) ? $new_instance['title'] : ''; $post_type = ! empty( $new_instance['post_type'] ) ? $new_instance['post_type'] : ''; $taxonomy = ! empty( $new_instance['taxonomy'] ) ? $new_instance['taxonomy'] : ''; $terms = ! empty( $new_instance['terms'] ) ? $new_instance['terms'] : ''; $number = ! empty( $new_instance['number'] ) ? $new_instance['number'] : ''; $order = ! empty( $new_instance['order'] ) ? $new_instance['order'] : ''; $orderby = ! empty( $new_instance['orderby'] ) ? $new_instance['orderby'] : ''; // 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 ); $title = ! empty( $new_instance['title'] ) ? $new_instance['title'] : ''; $post_type = ! empty( $new_instance['post_type'] ) ? $new_instance['post_type'] : ''; $taxonomy = ! empty( $new_instance['taxonomy'] ) ? $new_instance['taxonomy'] : ''; $terms = ! empty( $new_instance['terms'] ) ? $new_instance['terms'] : ''; $number = ! empty( $new_instance['number'] ) ? $new_instance['number'] : ''; $order = ! empty( $new_instance['order'] ) ? $new_instance['order'] : ''; $orderby = ! empty( $new_instance['orderby'] ) ? $new_instance['orderby'] : ''; ?>