'brikshya_blog_recent_widget', 'description' => 'Displays recent blog posts.', ); parent::__construct('brikshya_blog_recent_posts_widget', 'Brikshya Blog Recent Posts', $widget_options); } public function form($instance) { if (isset($instance['title'])) { $title = $instance['title']; } else { $title = __('Posts', 'brikshya-blog'); } if (isset($instance['posts'])) { $noOfPosts = $instance['posts']; } else { $noOfPosts = __('4', 'brikshya-blog'); } ?>

'post', 'posts_per_page' => $noOfPosts, 'post_status' => 'publish', ); $recent_post = new WP_Query($recent_post_args); if ($recent_post->have_posts()) : echo $args['before_title']; echo $title; echo $args['after_title']; while ($recent_post->have_posts()) : $recent_post->the_post(); get_template_part('template-parts/content-widget', 'recentpost'); endwhile; endif; wp_reset_query(); echo $args['after_widget']; ?>