'widget_latest_post', 'description' => esc_html__( 'Retrive latest posts.', 'pleased' ), ); parent::__construct( 'pleased_latest_post', esc_html__( 'TP : Latest Posts', 'pleased' ), $tp_widget_popular_post ); } /** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // outputs the content of the widget if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $tp_title = ( ! empty( $instance['title'] ) ) ? ( $instance['title'] ) : ''; $tp_title = apply_filters( 'widget_title', $tp_title, $instance, $this->id_base ); $tp_number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 3; echo $args['before_widget']; if ( ! empty( $tp_title ) ) { echo $args['before_title'] . esc_html( $tp_title ) . $args['after_title']; } $popular_args = array( 'post_type' => 'post', 'posts_per_page' => $tp_number, 'order' => 'DESC' ); echo '