Do you want to show your recent posts in WordPress? Displaying recent posts help users easily discover your new content and spend more time on your site.
You can add a list of your latest posts in your sidebar, after the end of your post content, inside your post content with a shortcode, in your footer widget area, or anywhere else you like.
In this article, we will show you how to display recent posts in WordPress using a variety of different methods
Why Add Recent Posts in WordPress?
If you have been running a WordPress blog or website for a long time, then you may have some older articles getting regular traffic from search engines and other sources.
Many of these users will check out the information they were looking for and leave. More than 75% of those visitors will never see your website again.
To keep users coming back to your website, you need to ensure that they spend more time on your website.
One way to do this is by showing them other recent posts that they should see. This helps users uncover more content on your website which leads to them spending more time on your website.
As users view more pages, this gives you time to convince them into signing up for your email newsletter or making a purchase.
That being said, let’s take a look at how to easily display recent posts in WordPress using multiple methods. Click on the quick links to jump straight to that method:
- Use WordPress’s Latest Posts Gutenberg Block
- Use the WordPress Recent Posts Widget
- Use the Recent Posts Widget With Thumbnails Plugin
- Display Recent Posts Using a Shortcode
- Display Recent Posts Manually in WordPress
Video Tutorial
If you’d prefer written instructions, just keep reading.
Method 1. Use WordPress’s Latest Posts Gutenberg Block
The WordPress block (Gutenberg) editor has a built-in block for displaying your latest posts. You can easily add this to any of the posts or pages on your site.
To use this block, simply edit the post where you to display recent posts. On the post edit screen, you need to add the ‘Latest Posts’ block to the content area.
There are lots of different ways you can configure this block. By default, it just shows the post titles, but you can easily customize it.
For example, you can toggle the post content on and off in the right-hand pane. This lets you choose to add post content or excerpt next to the title.
You can also customize excerpt length which defaults to 55 words, but you can pick any value between 10 and 100 words.
If you want, you can display the post date. This will appear just below the title.
You can also choose exactly how your posts will display. You can order them differently from the default ‘Newest to Oldest’, and you can show only the latest posts from a specific category.
From the settings panel, you can also choose how many posts will display. By default, the block shows 5 posts, but you can display anywhere between 1 and 100 posts.
You also have the option to display your recent posts in a column grid rather than a list.
You can customize the grid to featured images for your posts, resize the image, and align them accordingly:
Here’s how the finished block looks live on the website:
Method 2. Use the WordPress Recent Posts Widget
What if you want to show a list of your latest posts in your sidebar instead of on a page? WordPress comes with a built-in default widget to display recent posts in your site’s sidebar or any widget ready area.
In your WordPress dashboard, go to Appearance » Widgets and add the ‘Recent Posts’ widget to your sidebar.
The built-in Recent Posts widget doesn’t offer many options. You can give the widget a title, choose whether or not to show the dates of posts, and add the number of posts you want to display.
Once you’re done, click on the ‘Save’ button to store your widget settings.
Here’s the widget live on the blog, with the title ‘New Posts’ and dates enabled:
Method 3. Use the Recent Posts Widget With Thumbnails Plugin
The built-in widget we mentioned above is quite limited.
What if you want to display thumbnails and excerpts with your recent posts? What if you’d like to only show posts from a specific category in your sidebar?
Well, that’s when the Recent Posts Widget With Thumbnails plugin comes in handy. It does a lot more than just thumbnails, and it’s free.
First, you’ll need to install and activate the WordPress Recent Posts Widget With Thumbnails plugin.
Next, go to Appearance » Widgets page where you should see the ‘Recent Posts With Thumbnails’ widget.
You need to add it to your sidebar or another widget-enabled area.
The Recent Posts With Thumbnails widget comes with a lot of options. It gives you full control on how you want to display recent posts on your WordPress site.
You can also show excerpts, show posts from specific categories, ignore sticky posts, display random posts, and more.
Once you are done, don’t forget to click on the save button to store your settings. You can now visit your website to see your recent posts with thumbnails.
Method 4. Display Recent Posts Using a Shortcode
Using the ‘Latest Posts’ block is definitely the easiest way to display recent posts in WordPress posts and pages. However, if you chose to disable Gutenberg and keep the Classic editor, you can use shortcodes instead.
First, install and activate the Display Posts plugin. It works out of the box, and there are no settings for you to configure.
Simply edit a post or page where you want to display your recent posts. Next, use the shortcode [display-posts]
. The plugin offers a whole range of parameters that you can use with the shortcode.
Here are some examples of what you can do using this plugin.
Display 3 recent posts with thumbnails and excerpt:
[display-posts posts_per_page="3" image_size="thumbnail" include_excerpt="true"]
Display recent pages instead of posts:
[display-posts posts_per_page="3" post_type="page"]
Change the order to title instead of date:
[display-posts posts_per_page="3" orderby="title"]
Display recent pages under a specific parent page:
[display-posts posts_per_page="3" post_type="page" post_parent="5"]
You can also include additional styling. For instance, you may want to align your featured images to the left. You can do that using the instructions on the plugin’s website here.
Here’s how our list of recent posts looked, using those instructions:
For a full list of parameters visit the plugin’s documentation.
You can also use these shortcodes inside a text widget. First, you will need to enable shortcodes in your text widgets by adding this code to your theme’s functions.php file or a site specific plugin.
add_filter('widget_text', 'do_shortcode');
Method 5. Display Recent Posts Manually in WordPress
More advanced WordPress users may want to add recent posts directly in their WordPress theme files. Of course, you should use a child theme for this so that when you update your theme, you don’t lose your changes.
It’s always a good idea to create a backup before you edit your theme files. If anything does go wrong, you might want to take a look at our list of the most common WordPress errors and how to fix them.
The easiest way to manually display recent posts to use the built-in WP_Query class. Simply add this code where you want to display the recent posts.
<ul> <?php // Define our WP Query Parameters $the_query = new WP_Query( 'posts_per_page=5' ); ?> <?php // Start our WP Query while ($the_query -> have_posts()) : $the_query -> the_post(); // Display the Post Title with Hyperlink ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <li><?php // Display the Post Excerpt the_excerpt(__('(more…)')); ?></li> <?php // Repeat the process and reset once it hits the limit endwhile; wp_reset_postdata(); ?> </ul>
This code displays the five most recent posts with their title and excerpt. The WP_Query class has tons of parameters that allow you to customize it any way that you like. For more information please refer to the WordPress developer documentation.
We hope that this article helped you learn how to display recent posts in WordPress. You might also be interested in our article on how to create a separate page for blog posts in WordPress, and our comparison of the best drag and drop WordPress page builder plugins.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
I’m using ‘Display Posts’ and love it. I run a gardening website so if a post is called ‘How to Grow Beetroot’, is there any way by using Display Posts that the only part of the title that is displayed is ‘Beetroot’?
Thank you
The plugin by default does not change your post titles. You would want to reach out to the plugin’s support if you wanted that functionality
I can’t seem to get the Read More to appear in the published version. It appears in the editor but when I publish, it is gone. I’m using Astra theme.
You would want to check for if you need to enable excerpts with your specific theme for it to display how you are wanting.
Hi, When I click on the “Read more..” on a post on Recent Posts, it does not to go to that specific post page rather it loads the home page.
Appreciate if you can help on this.
Thanks
It would depend on what method you are using for possible issues and solutions.
This was really helpful thanks. Just a correction to note, in the last code snippet the comments are using // but they’re not actually in the php so they will show up if you use this code as-is.
Thank you for pointing that out, we’ll update the code to fix this
Hi, I”m still lost. My posts still don’t show up on my homepage, I have content blocks set up on my homepage and using Guterberg to set up the content. When I publish the post. It does not show up on my Homepage feature posts grid. There is something I am not getting.
You may want to clear any caching on your site to ensure your caching is not preventing the changes from being seen.
My blog shows bulleted post, how do I stop it from being an unordered list, and make it in grid?
You can use the new latest post block and use the built-in grid option in the block’s options
Hello Friends,
My query is what is the short code to display all the content of a post?!
It would depend on why you want to do that. If you want the entire content of a post to be visible to a user it would normally be best to link to the post you want to show so your users can read from the source.
My blog shows bulleted post, how do I stop it from being an unordered list, and make it in grid?
For making your posts appear in a grid, you would want to take a look at our article here:
https://www.wpbeginner.com/plugins/how-to-display-your-wordpress-posts-in-a-grid-layout/
Hello – I am trying to figure out why the Recent Posts widget (the basic one) is excluding my most recent post. I would like that to show. Is there custom CSS I could add to make it show? or can I edit the code?
The most common reason for something like that would be if you have caching or similar on your site that is preventing the widget from updating, you would first want to clear your cache. We have an article on how you’re able to do so here:
https://www.wpbeginner.com/beginners-guide/how-to-clear-your-cache-in-wordpress/
It would depend on how you want it styled but you could create a tabber widget for what I believe you’re wanting:
https://www.wpbeginner.com/wp-tutorials/how-to-add-jquery-tabber-widget-in-wordpress/
Thank you for the useful post.
I have a question. What if I want to display recent posts on front page categories wise. Like recent posts should appear on the front page under a particular category.
Is it possible?
Awesome as always. When I found wpbeginner is sharing on this topic I was like . But my question is placing post widget on homepage is beneficial or it’s just easy to navigate? Can it help with seo perspective? Can it help with the ranking? Your response highly appreciated
Making your site easier to navigate can improve your SEO as well as making it easier for your users to continue navigating through your site.
Thanks for recent post articles. I was trying so much but now its so easy to work just adding adding it. Thanks for sharing
Glad our article was helpful
thank you so much. this helped me a lot. thank you thank you
:).
You’re welcome
When I tried to edit the page that’s supposed to display blog posts, the editor disappears wit this notice: “You are currently editing the page that shows your latest posts”. Does anyone have this same problem as me?
The Blog page is automatically generated by your theme so you will not have the option to edit it directly unless you have a theme specific setting to edit it.
HI…..i just started using WP and i need some help! i want to publish articles from 3 different categories to 3 different pages.how can i make a page point to an article category?
Is there a way to customize the way post titles are displayed? I don’t want to display the full title of the post or page, just the keywords… much like you shorten the slug for your url. Actually this is exactly what I’m looking for, to display the slug as a link, and not the entire page title. Ideas?
Great article, When I use the Recent post widget and set it to only display a category my sticky posts do not work. Have you encountered this before or know of a solution?
Hi, thanks for this complete article.
I have a doubt, if I have my wordpress integrated with Magento, can I use magento within the short code to put the last entries in my magento house?
The short code to display recent posts with thumbnails does not work… only shows the posts title not the thumbnails… how to fix this.??? please reply…:(
Hi,
I am intending on adding the latest posts on my homepage, but I want a different section for the latest post to display on it’s own;
and another section under this designed differently for the latest posts that range from 2-5. (The 2nd, 3rd, 4th and 5th post).
What is the shortcode php for this to add to my theme template.
Many thanks.
Hello,
I have post shortcode on my page:
I’ve tweaked it a little bit as follows:
[display-posts posts_per_page=”100″ include_excerpt=”false” image_size=”large” wrapper=”div” orderby=”comment_count”]
I’m noticing that the spacing in between the posts is cutting off the titles and it makes the page look sloppy. What code can I add to add a little space after each post preview?
thanks in advance!
James
Hi James,
You can adjust spacing between posts using CSS.
Thanks! I was struggling with adding recent posts to a page. Your guide saved me a lot of time
Thank you for this tutorial!
You are welcome
Love the idea, the only thing I don’t like is the display.
So it’s great how it has the thumbnail, title, excerpt, etc but the way the title and excerpt are positioned…I think they should be inline with the thumbnail, not at the bottom of it…it looks awkward and unappealing…any way to make it inline?
Please help me with this
How to display recently post in a post on phone version?
Reply please… Thanks
If I am using 2 database. 1 for main site and 2nd for blog then how to add recent post on home page ?
Hi, I put [display-posts posts_per_page=”5″ post_type=”page”] on my post, but not working, can you help how to find the problem?
Great writeup. I want to display the recent post on a page. awahere am I suppose to paste the code?
this article can help me thank you : )
gereat … thanks a lot .
How to show thumbnail of 1st post bigger and others smaller…..
You could perhaps use :first-child CSS to do this.
Hi,
Thank you for this post. Really helped a lot.
But then I have a problem. When I click on one of the recent posts – it directed me to the static page and not the post itself. Kindly help me resolved this issue. Thank you.
Try updating your permalink structure. Simply visit Settings » Permalinks and then click on the save changes button without changing anything.
So glad to have found you!
I’m confused – I can’t seem to get my most recent blog post to appear on my blog page. Can you advise please? Thank you so much!
best, Ellen Allard, Gluten Free Diva
So I was able to get the 5 latest post to show in the right sidebar but when I click on a post to read it I get the following error on Home Page Oops something went wrong
How do I get the selected post to display?
Are links to the recent posts widget dofollow links?
Hi – thanks million for this manual method, very grateful. Please can you tell me how to add a thumbnail image to it? I’m referring to the method starting:
// Define our WP Query Parameters
hello,
To display a thumbnail image u can ues
Hi Val, Hope your doing well, I was just scrolling through this article and saw your name and thought straight away I know that name! It’s a small world.
I made one of your sprouters in the late 90’s I think it would have been.
Funny thing is I was just thinking about building another one a few days ago!
Crazy how things happen sometimes!
Weird that I then just stumbled across your comment on here today in 2018 while I’m working on my website for something totally unrelated.
I remember I really enjoyed reading about your life and the move to Sth Africa, your cures for tooth aces etc. I’ll have to have another look into it all again soon when I have time, anyway just thought I’d say Hi.
Hello, I used the same shortcut in my site but it not show my recent posts at all, what is the probelm?
This article shows several ways to display recent posts, which one you tried on your website?
Hey, how to display recent posts from another wordpress site?
You can fetch them using RSS feed. Please see, how to fetch feeds in WordPress.
Hi,
On my recent posts on the sidebar, when I click a specific post it brings me to the latest post and then displays everything. How do I get it so that when I click a specific post it only shows that post?
Thanks!
Is there a code I can add to activate pagination using the Recent Posts Extended widget?
Currently I have my home page widgetized so I’m using the widget.
Thanks!
Hello,
Please let me know if it’s posible to show the post list in dropdown?
Hi! Great plugin, thank you!
Is it possible to have the author listed, instead of the post name?
Thanks!
The version I downloaded does not include the ability to display thumbnails…cant see the option anywhere. I am using version 0.9.9
Any clues?
Hi, my issue is to display the latest post full content in a static home page… and i was thinking that the last snippet was what i needed… but unfortunately it does not works properly. In effects it shows title but not the content. could u help me please
Hi I am new on wordpress, I want to show Client Testimonial using post….How should I do it..? any suggestions please ?
Here is an easier way. Install Display Posts Shortcode plugin. Create a blank page and add the shortcode as described in plugins documentation. Publish the page. Go to Settings > Reading and select the page you just created as your static page. Redit the static page and add the slider just before the display posts shortcode. Hope this helps you.
please how do decrease the number of words showed before the read more link i.e decrease the excerpt
Please see our guide on How to customize WordPress excerpts (no coding required).
Hi, I am wanting to add a slider to the top of my homepage, but it will only allow me to do so if I use a static page. Right now when you go directly to my website, it is my latest posts in full length. If I change my homepage to a static page so that I can include the slider, will this work to add the recent posts below, just as it appears now? Where would I be posting this code? Into the static homepage?
Note– I recently tried messing with my php and broke my code and had some major issues.. so I’m pretty nervous messing with php.
hi!…can anyone tell me how to display top rated blog posts (only 5) in increasing order (numeric order) by using PHP codes?
Hi there. I am a designer so I’ve never been good at PHP. At least I can read and change it for my conditions most of the time. This time I’d like to call for the nine latest posts excluding the very last one inside my slideshow container.
For now I just set the first post on display none. This works fine; however the slideshow still counts to ten. That’s why you find the last page empty.
Is there any way to exclude the very last post when calling for recent posts? Thank you so much in advance!