Knowing how to display a recent posts widget in WordPress is one of the most effective ways to keep visitors engaged, reduce bounce rates, and surface fresh content automatically across your site. Whether you run a blog, news site, or business website, showing your latest articles in a sidebar or footer encourages readers to explore more of what you have published. This guide walks you through every available method — from the built-in WordPress widget to plugins and custom PHP code — so you can choose the approach that best fits your needs.
Understanding the WordPress Recent Posts Widget
WordPress ships with a native Recent Posts widget that requires zero coding knowledge to use. It pulls your latest published posts from the database and displays them as a simple linked list. Before diving into the steps, it helps to understand what this widget can and cannot do out of the box.
What the Default Widget Offers
- Display between 1 and 15 recent posts
- Optionally show the post date alongside each title
- Customisable widget title
- Works in any registered widget area (sidebar, footer, header)
Limitations of the Default Widget
- No thumbnail or featured image support
- No post excerpt display
- No category filtering
- Limited styling options without custom CSS
If you need more control, the sections below cover plugin-based and code-based solutions. But for most standard blogs, the built-in widget is a great starting point.
How to Add the Built-In Recent Posts Widget (Classic Widgets)
If your theme uses the classic widget system (most themes still do, or offer it as an option), follow these steps to add the default Recent Posts widget to your site.
- Log in to your WordPress dashboard.
- Go to Appearance > Widgets in the left-hand menu.
- Locate the widget area where you want to display recent posts — for example, Primary Sidebar or Footer Widget Area.
- Click the + (Add Block) button inside that widget area, or if you see a list of available widgets on the left, find Recent Posts.
- Drag and drop the Recent Posts widget into your chosen area, or click it to add it automatically.
- Configure the widget settings:
- Title: Enter a heading such as "Latest Articles" or leave it blank.
- Number of posts to show: Choose a value between 1 and 15.
- Display post date: Tick this checkbox if you want dates shown.
- Click Save or Update.
- Visit your website to confirm the widget is displaying correctly.
The widget will now automatically update every time you publish a new post — no manual intervention required.
Adding a Recent Posts Widget in the Block Editor (Full Site Editing)
If your theme supports Full Site Editing (FSE), such as Twenty Twenty-Three or Twenty Twenty-Four, widget areas work differently. You manage them through the Site Editor rather than the classic Widgets screen.
Using the Site Editor
- Navigate to Appearance > Editor in your WordPress dashboard.
- Select the template part you want to edit — for example, Sidebar or Footer.
- Click inside the template part to activate the block editor.
- Press the + button to add a new block.
- Search for Latest Posts (the FSE equivalent of the Recent Posts widget).
- Click to insert the block.
- Use the block settings panel on the right to configure:
- Post layout (list or grid)
- Number of items
- Whether to show featured image, author, date, or excerpt
- Image size and alignment
- Click Save to publish your changes.
Using the Latest Posts Block in Page Content
You can also embed the Latest Posts block directly inside any page or post using the standard block editor. Simply open a page, add a new block, search for Latest Posts, and configure it in the same way. This is useful for homepage sections that showcase your newest content.
Using a Plugin for a More Feature-Rich Recent Posts Widget
When you need thumbnails, excerpts, category filters, or advanced styling, a dedicated plugin gives you far more control than the default widget.
Recommended Plugins
- Recent Posts Widget Extended — Adds featured images, excerpts, category filtering, and custom post type support.
- Jetpack — Includes a powerful Recent Posts widget with image support as part of its wider feature set.
- WP Shortcodes Plugin — Lets you embed recent posts anywhere using a shortcode.
- Essential Addons for Elementor — If you use Elementor, this adds a fully styleable Recent Posts widget.
Installing Recent Posts Widget Extended
- Go to Plugins > Add New in your dashboard.
- Search for Recent Posts Widget Extended.
- Click Install Now, then Activate.
- Navigate to Appearance > Widgets.
- Find Recent Posts Extended in the widget list and drag it into your chosen widget area.
- Configure the advanced options:
- Set the number of posts to display.
- Enable the featured image thumbnail and choose a size.
- Tick Show excerpt and set the excerpt length.
- Filter by category if needed.
- Optionally exclude certain post IDs.
- Click Save.
Your sidebar will now show recent posts complete with images and short descriptions, making it far more visually engaging than the default widget.
Displaying Recent Posts with Custom PHP Code
For developers or site owners comfortable editing theme files, using a custom WP_Query loop gives you complete control over which posts appear and how they are formatted. This method is ideal when you want to integrate recent posts directly into a template file rather than a widget area.
Adding the Code to Your Theme
Always use a child theme when editing theme files so your changes are not overwritten by theme updates. Open the appropriate template file (such as sidebar.php or a custom template part) and add the following code:
<?php
// Display 5 most recent posts with title and date
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
);
$recent_posts = new WP_Query( $args );
if ( $recent_posts->have_posts() ) :
echo '<ul class="recent-posts-list">';
while ( $recent_posts->have_posts() ) :
$recent_posts->the_post();
echo '<li>';
echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
echo '<span class="post-date">' . get_the_date() . '</span>';
echo '</li>';
endwhile;
echo '</ul>';
wp_reset_postdata();
endif;
?>
Registering a Custom Widget Using This Code
If you want to turn this query into a proper widget you can manage from the Widgets screen, you would extend the WP_Widget class. For most users, however, placing the snippet above in a template file or using the get_template_part() function is the quickest route.
Running WP-CLI to Check Widget Registration
If you manage WordPress from the command line, you can verify which sidebars and widgets are registered on your site using WP-CLI:
wp widget list sidebar-1 --fields=id,name,position
This command lists all widgets currently active in sidebar-1, showing their IDs, names, and display order — useful for debugging or scripted deployments.
Styling and Customising Your Recent Posts Widget
Once the widget is in place, you may want to adjust its appearance to match your theme. The best way to do this without touching core files is through the WordPress Customizer or a custom CSS block.
Adding Custom CSS in the Customizer
- Go to Appearance > Customize.
- Click Additional CSS at the bottom of the left panel.
- Add your CSS rules targeting the widget wrapper. For example:
.widget_recent_entries ul li a {
font-weight: bold;
color: #333333;
text-decoration: none;
}
.widget_recent_entries ul li .post-date {
display: block;
font-size: 0.85em;
color: #777777;
margin-top: 2px;
}
- Click Publish to save your styles.
Tips for a Better Visual Presentation
- Use a plugin like Recent Posts Widget Extended to add featured image thumbnails — visual lists consistently outperform plain text lists in click-through rates.
- Keep the number of displayed posts between 3 and 7 to avoid overwhelming visitors.
- Add a "View All Posts" link at the bottom of the widget pointing to your blog archive.
- Consider using a grid layout on wider areas (such as the footer) for a magazine-style look.
- Test your widget on mobile — long post titles can break layouts on small screens.
Frequently Asked Questions
Why is my Recent Posts widget not showing any posts?
This usually happens when no posts are published, when the widget is placed in an inactive widget area, or when a caching plugin is serving a stale version of the page. Check that you have published posts, confirm the widget area is active in your theme, and clear your site cache after saving the widget settings.
Can I show recent posts from a specific category only?
The default WordPress Recent Posts widget does not support category filtering. To filter by category, use a plugin such as Recent Posts Widget Extended, or write a custom WP_Query loop and pass the cat parameter with your category ID (e.g., 'cat' => 5).
How do I add a recent posts widget to a specific page only?
WordPress widgets typically appear site-wide in their assigned areas. To show a widget on one page only, use a plugin like Widget Logic or Display Widgets, which let you add conditional display rules — for example, showing the widget only when is_page(42) returns true for a specific page ID.
Does the Recent Posts widget slow down my website?
The built-in widget uses a simple database query that WordPress caches efficiently, so the performance impact is minimal. However, plugins that load additional thumbnails, run multiple queries, or add their own scripts can introduce slight overhead. Always test page speed with a tool like Google PageSpeed Insights after adding new widgets.
Displaying a recent posts widget in WordPress is straightforward whether you use the native widget, a plugin, or custom code — and the right choice depends on how much control and visual richness you need. If you find yourself wanting to make changes like these without digging through menus or code, WP AI Agent is a powerful tool that lets you manage WordPress tasks — including adding and configuring widgets — through simple natural-language AI chat, making site maintenance faster and more accessible than ever.