How to Display Recent Posts in WordPress?
By default, WordPress displays your most recent posts in reverse chronological order on the homepage of your website. By editing the default “Recent Posts” widget, you can display the latest content in the sidebar and other widget-ready areas, but the controls and settings are pretty minimal.
In this guide, we will show how to display the newest articles in WordPress with recent post function, plugin as well as a shortcode.
The selected Recent Posts Widget Extended and Display Posts Shortcode plugins will give you more control over how recent posts are featured from widget areas and custom post types.
#1: Using WordPress “Recent Posts” Widget
As noted, WordPress comes standard with a widget for displaying a selection of posts in the sidebar or footer widget areas. From the WordPress dashboard, just go to “Appearance” > “Widgets” and then add this “Recent Posts” widget to a preferred widget area.
That’s very basic, and you’re only allowed to name this widget, show date and set how many posts will be displayed. After all settings, remember to click “Save” button to take effect.
#2: Using the Recent Post Widget Extended Plugin
Download: https://wordpress.org/plugins/recent-posts-widget-extended/
The Recent Post Widget Extended plugin by Satrya is a popular choice with over 90,000 active installs and a positive 4.8 out of 5-star rating. That comes in handy when you want to display a list of recent posts with thumbnail, excerpt as well as the publication date. The allowed languages include English, France and Brazilian Portuguese, and the newest 0.9.9.2 version requires WordPress 3.7 or higher versions.
The first step is to install and activate this plugin as you usually do. If done, navigate to “Appearance” > “Widgets” so that you can drag and drop this “Recent Posts Extended” widget to a sidebar.
As shown, a lot of customization options are included in this widget. You can not only create a widget title and its URL, but also display post status, order, thumbnails and excerpts. It’s optional to limit categories, tags as well as taxonomy, and sticky posts can be hidden if needed. The remaining options let you add CSS class, HTML or text before/after the recent posts.
#3: Using the Display Posts Shortcode Plugin
Download: https://wordpress.org/plugins/display-posts-shortcode/
Displaying recent posts in WordPress sidebar is quite easy, but what if you’d like to display them within the WordPress post/page? The easiest way is by using this “Display Post Shortcode” plugin that lets you show listings of blog posts without editing template files or knowing PHP code. There are no settings to configure, and you can use the arguments to add some extra options. It requires WordPress 3.0 or much higher versions.
Upon activation, just edit a new or existing post where you’d like to add the recent posts. Here, just use the [display-posts] shortcode with custom parameters inside the post editor. A lot of parameters are available for your use, and below are some examples:
Image Alignment
It’s possible to display a set of posts with post tag, excerpt and the thumbnail aligned to the left. Here is how the shortcode looks like:
[display-posts image_size="thumbnail" include_excerpt="true" tag="basic-guide"]
To customize the thumbnail size, just go to “Settings” > “Media” from the WordPress sidebar menu.
More Examples:
- This will display the 8 most recent posts with excerpts and thumbnails.
[display-posts posts_per_page="8" include_excerpt="true" image_size="thumbnail"]
- This will list 8 recent pages instead of posts with the “basic-guide” tag.
[display-posts posts_per_page="8" post_type="page" tag="basic-guide"]
- This will show recent posts within the “tutorials” category by title instead of date.
[display-posts posts_per_page="8" orderby="title" category="tutorials"]
- This will present the excerpt and title of the 10 most recent posts that are marked with “green” in the custom “color” taxonomy.
[display-posts include_excerpt="true" taxonomy="color" tax_term="green"]
Notes: For more useful parameters, just visit this documentation page of the plugin. Alternatively, you can apply those shortcodes to a text widget by pasting the following code to your functions.php file.
add_filter('widget_text', 'do_shortcode');
Top WordPress Recent Post Plugins
At the same time, there are many other plugins that enable you to display the latest content in a variety of different ways, helping readers discover more of your content. Those non-commercial plugins can be easily searched and installed via the WordPress repository.
- Better Recent Posts Widgets that is more than just a simple alternative to the “Recent Posts” widget by letting you set the number of posts to display, offset the posts shown in the widget and show custom post types. Its pro version is multisite capable and gives you the ability to present post author, comment count and sorting method, etc.
- Genesis Featured Widget Amplified that enables you to upgrade standard featured posts widget based on Genesis Framework in a straightforward way. As for features, it excludes term by ID field but supports custom taxonomies, pagination and meta key values.
- Flexible Posts Widget that will add a new widget to the available options, letting you continue using the “Recent Posts” widget along with the upgraded version. It comes with many pre-instance options and is compatible up to WordPress 4.3 version.