esc_html__('Recent Posts', 'arther'), 'post-number' => 5, ); return $defaults; } public function __construct() { $opts = array( 'classname' => 'arther-latest', 'description' => esc_html__('Recent Posts Widget with Thumbnail.', 'arther'), ); parent::__construct('arther-latest', esc_html__('Arther Recent Posts', 'arther'), $opts); } public function widget($args, $instance) { $instance = wp_parse_args((array)$instance, $this->defaults()); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . esc_html($title) . $args['after_title']; } $post_number = !empty($instance['post-number']) ? $instance['post-number'] : ''; ?>
'post', 'posts_per_page' => absint($post_number), 'ignore_sticky_posts' => true, ); $p_query = new WP_Query($p_query_args); if ($p_query->have_posts()) : ?>
    have_posts()): $p_query->the_post(); ?>
defaults()); $title = esc_attr($instance['title']); $post_number = absint($instance['post-number']); ?>