Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Display Recent Posts in WordPress

Do you want to show your recent posts in WordPress? Displaying recent posts helps 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.

How to display recent posts in WordPress

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 to sign up for your email newsletter or make 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:

Video Tutorial

Subscribe to WPBeginner

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 want to display recent posts. On the post edit screen, you need to add the ‘Latest Posts’ block to the content area.

Add latest posts block

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.

Show post content in recent posts

If you want, you can also display the post date and post author.

Simply enable the ‘Display post date’ and ‘Display author name’ options under Post Meta Settings.

Display post date and author

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.

Sort and filter recent posts

You also have the option to display your recent posts in a column grid rather than a list.

View latest posts in grid view

You can customize the grid to show featured images for your posts, resize the image, and align them accordingly:

Show featured images in latest posts

Here’s how the finished block looks live on the website:

Latest posts preview

Method 2. Use the WordPress Recent Posts Widget Block

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 ‘Latest Posts’ widget block to your sidebar.

Add latest post widget block

You can then customize the appearance of your recent posts in the sidebar.

For instance, WordPress lets you show post content, display post author and date, enable featured images, and sort your latest posts.

Customize recent posts widget block

Once you’re done, click on the ‘Update’ button to store your widget settings.

Here’s the widget live on the blog, with the title ‘New Posts’ and dates enabled:

Latest posts in sidebar menu

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 the Appearance » Widgets page and then add the ‘Recent Posts With Thumbnails’ widget block.

Add recent posts with thumbnails widget block

The Recent Posts With Thumbnails widget comes with a lot of options. It gives you full control over how you want to display recent posts on your WordPress site.

You can also show excerpts, show posts from specific categories, ignore sticky posts, choose the number of posts to show, display authors, and more.

Customize recent posts with thumbnails

Once you are done, don’t forget to click on the ‘Update’ button to store your settings.

You can now visit your website to see your recent posts with thumbnails.

Recent posts widget with thumbnails preview

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 choose to disable Gutenberg and keep the Classic editor, you can use shortcodes instead.

First, install and activate the Relevant plugin. If you need help, then please see our guide on how to install a WordPress plugin.

It’s one of the best popular post plugins for WordPress. You get multiple options to customize the appearance of your latest posts, like editing the title, the number of posts, selecting whether you’d like to display a featured image, excerpt, post date, and more.

Change relevant settings

Next, simply edit a post or page where you want to display your recent posts and then use the shortcode [bws_latest_posts].

Here’s how our list of recent posts looked, using those instructions:

Display recent posts 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.

// Define our WP Query Parameters
$the_query = new WP_Query( 'posts_per_page=5' ); ?>
// 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>
// Display the Post Excerpt
the_excerpt(__('(more…)')); ?></li>
// Repeat the process and reset once it hits the limit

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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

134 CommentsLeave a Reply

  1. 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.

  2. 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

  3. 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?

  4. 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

    • 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.

  5. Hello, I used the same shortcut in my site but it not show my recent posts at all, what is the probelm?

  6. 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?


  7. 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.


  8. Hi! Great plugin, thank you!
    Is it possible to have the author listed, instead of the post name?

  9. 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?

  10. 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

  11. Hi I am new on wordpress, I want to show Client Testimonial using post….How should I do it..? any suggestions please ?

  12. 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.

  13. 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.

  14. hi!…can anyone tell me how to display top rated blog posts (only 5) in increasing order (numeric order) by using PHP codes?

  15. 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!

  16. Hi, I want to display blog posts only from a category called ‘Blog’ only. (I want to exclude all other posts from other categories.) What should I add to this code.?

  17. showposts is deprecated. However, posts_per_page is perfect for use with query_posts(), or even more particularly, WP_Query::query().

    numberposts may be the equivalent argument for get_posts().

  18. Good article.

    One piece of info that would increase it’s usefulness though, is how to (or a plugin that can) include an offset.

    For example, I want my two most recent posts to be full text — got that.
    But what if I want the next 10 to be excerpts, and maybe the next 10 older to be headlines only — the list?

    So — how can you include an offset?


  19. Hi there,

    I want my latest 4 posts to display inline across the screen, how would I do this?

    Currently they only display down the page.



    • Sounds like you need to create a container with the height/width you want the posts to appear as. Then allow them to wrap over.. make sure that the last piece of your “Post” code doesn’t have a line break.

  20. Great post! Thanks!

    Just one question. Is it possible to hide the latest post out of 5? I mean on my website I display the latest post already with full content, so I would like to hide the first.

  21. Finally a quick and to the point tutorial on this topic. Other posts on calling in the recent blog posts were not as quick and too the point. Thanks :D

  22. Hi Syed,

    I use the WordPress Twenty-Eleven theme and have always displayed recent posts using the widget in Jetpack. But I want this list to show in the individual posts as well. Is there a way to do this? If it involves pasting code, into which file do I paste?

      • The home page of AWildDuck -d0t- com, shows recent posts along the right side, along with subscribe and a tag cloud. But this appears only on the home page. If I send you a link to any individual post (or if you click on the title of any post), the right frame disappears. My visitors can no longer see a list of recent posts. I am very frustrated by this, and I want to know how to get that list of recent posts to appear on all pages. (Not just the home page).

        • Hi Syed,
          Indeed, this is my current setting. It has always been my setting. Twenty Eleven with “Content on left”.

        • I don’t understand… Do you see Recent Posts on the right, even when you are looking at an individual post? If you do, are you using JetPack/Recent Posts?

          If the answer to both questions is “Yes”, would you please send me your phone number. You already have my email address. -Or call me: Area code “Five-Oh-EIght”, 485 ..695O.

          Thanks, –Ellery

      • thank you, yes, but I ask not only for me but thinking of other visitors, it can be more useful in your article, give an example of recent articles with thumbnails.

      • Thanks so much for this tutorial! I used the code to display recent posts with a summary on my website’s homepage.

        When adding the_post_thumbnail(); code could you please tell me what file and where in the file to add it? I tried looking it up and experimented by adding it to several files on my own and was not able to get the thumbnails to show up.

        Any insight would be greatly appreciated.

        Thank you,


        • In your Post Edit area, post thumbnails are called featured image. If you can not see a featured image meta box, then click on Screen Options button on the top right corner of your post edit screen and check Featured image.

  23. Nice Post.
    How can I achieve – Recent Posts in Menu. Like I have my category “Crime” on top-menu. Now whenever a user hover it, I want to show 5 recent posts from category “Crime” with their thumbnails?

  24. Spent a lot of time to find out this information which works for me 100%. Its very easy and to the point. Thanks…… God bless you.

  25. I have tried to use this code and it doesn’t seem to work? I am a beginner and am using a standard theme and not hosting. Therefore I can’t upload anything I can only use HTML.

  26. My WP homepage has a footer displaying the titles of my 4 latest posts (Recent Posts). This makes no sense, as these posts are already displayed above.

    My question is how can my footer display the range between 5th and 8th post ??

    The code its currently using is

    <?php wp_get_archives('type=postbypost&limit=5');

    Many thanx in advance for your help

      • Thank you very much for your kind reply. Can you please let me know how I can do that? I know very few stuff and i definately need to have this done by the day after tomorrow that I’m launching my site.

  27. I’ve been looking for this code for a few days now. I can’t believe it’s not more readily available in the Template Tags pages or any other blogs.

    I changed the code to include tags and tags instead of the tags like the following:

    <a href="”>

    Thanks for posting!

  28. One problem with the above code is when you call that function in your sidebar which is called before the start of the loop in single.php. Your single.php file will list down all the articles of your blog post irrespective of the one which is called.

    In such cases, you can also use

    Otherwise, calling query_posts(‘showposts=10’); function is fine.

    Both of them will list down latest 10 posts in ul, li format. This is bit easier.

  29. Hi, is it possible to show the date before the linked post title when using:
    <?php get_archives('postbypost', '10', 'custom', '’, ”); ?>


  30. Hi Guys

    I seem to be having some issues with this code. It works great on my index.php page but when I try adding it to either the page.php or single.php it prevents other content showing. For example when I click the ‘about us’ page it will display the latest article!

    Hope this makes sense and any help anyone can offer would be greatly appreciated.


  31. i want to display posts in order of post date.. recent one first with pagination i am able to do the pagination but the posts are displaying on each page in random order somebody please help………….:(

  32. I want to know how to display rcenet posts with thimthumb thumbnial.

    Unfortunately Google is being Google as usual and not giving me the results I want.


    • You can simply add timthumb codes anywhere in these codes, and it should work. The query will be run the exact same way. If you are looking for a step by step guide, we haven’t written one. Although we might write one in the future.


  33. I am so glad I found this, I have been trying to do this for days and I couldnt find exactly how to do this on the wordpress codex !!! the only sollution they seemed to offer screwed up the custom homepage I built, but this works perfect.

    Thanks very much.

  34. Good info!

    I’m trying to display the latest 5 posts using the last method you described, but I can’t figure out how to get page numbers. For example, the faux blog page displays the last five posts, but there is no way to go back in time from there.

    I have not been able to find a solution for this. Any suggestions?


Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.