How to Display Recent Posts in WordPress Sites

Disclosure: WPrBlogger content is reader-supported. This means we may receive financial compensation if you purchase products or services on the merchant website, but at no additional cost to you.

Displaying recent posts on your blog is an excellent tactic to keep readers engaged and increase pageviews. 

Thankfully, WordPress has made it easy to display recent posts on your blog effortlessly. You can add a list of the latest posts from any category anywhere on your blog, including the sidebar, footer, homepage, and post/pages.

With a simple WordPress widget or block functionality, you’re set. 

After reading this post, you’ll have the knowledge to add recent posts to your WordPress blog. And get your visitors more engaged with your content. 

Benefits of Adding Recent Posts to WordPress Blog

Most visitors will find your website either through search engines, direct visits, marketing promotions, etc.

Regardless of the traffic sources, they probably will visit a single page. After going through the information they are looking for on your site, they might leave and never come back. 

You’re losing a good chance to turn casual website visitors into loyal fans. 

Why not showcase some of your recently published posts and make the visitor spend more time on your site? 

This will improve time on site, engagement, and conversion, generate leads, and increase revenue potential.

There are many benefits to adding recent posts widgets to your blog. The more creative you get at using it, the better your chances of building loyal fans. 

That said, let’s explore the various ways to show recent posts in WordPress. We will walk you through beginner-friendly ways to display the latest posts on your blog. 

Also, we will explore a few advanced options. 

1. Using Gutenberg Block – Latest Post

One of the simplest ways to add the latest posts to WordPress sites is the Gutenberg Latest post block. 

The Latest Posts Gutenberg block is a powerful tool that makes it incredibly easy to display your recent posts on your WordPress website. This block is part of the core WordPress installation, so you don’t need to install any additional plugins.

The good part is that you can add the Latest Post Block to even the sidebar. I will show how in a moment. 

But first, let’s assume you want to add the Latest Post block to a post or page. It could be a new or existing page/post. It doesn’t matter. 

Open the post or page in the Gutenberg editor. Click the + sign either on the editor toolbar or on the content block. Either way, the block search box will pop up.

Searching for Latest Post Block in Gutenberg Editor

Type and choose the Latest Post Block from the options. This block automatically displays your most recent posts. 

By default, it displays the post titles only and presets the last five entries. However, you can configure the default setting in the Block Customizer. 

There are several options you can play around with to customize its appearance. Here are a couple of options you can enable or turn off.

Latest Post Block setting in WordPress
  • Post Content – This option lets you display and customize excerpts for the Latest Post Block. You can choose between an Excerpt or a Full Post and customize the number of words (Excerpt only). 
  • Post Meta – This setting lets you display the author’s name and publication date. Toggle the setting that you want or both.
  • Featured Image – Do you want to include the post-featured image? Turn on the option here and fine-tune the settings, such as thumbnail size, image alignment, width, and height.  
  • Number of Items – Determine how many recent posts you want to display. The default is five, but here, you can set your number from 1 to 100. 
  • Order By – Select the order in which the posts should appear (latest first or oldest first, A – Z, or Z – A).
  • Categories – You can specify which post category to display. Leave empty if you don’t want to exclude any category. Because selecting a category(ies) automatically excludes other categories from display. 
  • Author – If there are multiple blog authors, specify which author’s post to display. Otherwise, leave it empty to show posts from all authors. 

In addition to the main settings, you can also choose between grid or list view. The setting is available on the Gutenberg Block toolbar. 

Watch the GIF below to see how you can turn on the grid or list view for the Gutenberg Latest Post Block. 

How to select grid or list view for recent post in Gutenberg latest post block

Once you’re satisfied with the settings, save your page or post and preview it to see how your recent posts look. Hit the save button to publish the changes. 

That’s it; you are good to go. 

Benefits of Using the Latest Posts Block.

  • Easy to use – The block is intuitive and requires minimal setup.
  • Highly customizable – You can tailor the block to match your website’s design and content.
  • Mobile-friendly – The block is optimized for mobile devices, ensuring a great user experience on all screens.

By using the Latest Posts Gutenberg block, you can quickly and easily create a visually appealing section on your WordPress website that highlights your most recent content.

2. Use the Latest Posts Widget in the Sidebar/Footer

The first method I showed you lets you add the Latest Post Block to the content body. This next option enables you to add it to either the sidebar, footer section, or any other widget-ready area.

WordPress has a built-in Latest Post widget that allows you to display the recently published posts in the widgets-enabled area. 

This is an excellent option to showcase more content to your readers as they scroll the page down to the footer section. This method is ideal for those who prefer a traditional layout for their website – i.e., the left/right sidebar layout.

Follow these steps to enable recent posts on the WordPress sidebar or footer.

First, go to Appearance and click Widgets. If you have two or more active sidebars, locate the one you want to add the Latest Post Widget to. 

Once you figure this out, click the + sign and search for the Latest Post in the box. Next, click to add it to the sidebar. 

Now, just like the Gutenberg Latest Post Block customization option above, you can configure the Latest Post Widget setting, too. 

To do this, ensure the Latest Post Widget block is active. This automatically switches to the tab on the right-side panel to the block setting.

Latest Post Widget setting on the widget page

Within these settings, you can customize the author profile, show the post date, featured image, thumbnail setting, number of excerpts, list or grid view, and more. 

Everything you can do with the Gutenberg Latest Post Block you can do with the Latest Post Widget. The settings are the same. 

Benefits of Using the Recent Posts Widget

  • Simple and straightforward – The widget is easy to set up and use.
  • Customizable – You can tailor the widget to match your website’s design and content.
  • Versatile – The widget can be used in multiple locations on your website.

Using the Latest Posts widget lets you effectively highlight your latest content in a prominent location on your website.

3. Using Shortcodes

Using shortcodes is another way to display recent posts on your WordPress site. It provides a unique and advanced method to showcase important content in WordPress. 

Shortcodes also provide a powerful way to customize how recent posts are displayed on your WordPress website. 

By using shortcodes, you can easily control various aspects of your posts, such as the number of posts to show, the post content, and the order in which they appear.

Example Shortcode:

[recent_posts posts_per_page=”5″ excerpt_length=”50″ orderby=”date” order=”DESC”]

This shortcode will display the five most recent posts with an excerpt length of 50 words, ordered by date in descending order.

That being said, you can take things further by using a dedicated WordPress recent post shortcode plugin, such as Relevant. This plugin has other purposes, such as displaying featured posts, popular posts, and related posts with thumbnails

It also has several useful features you may want to check. 

For example, you can add the code to before or after content, sidebar, widget area, custom post type, etc. You can customize the related, recent, or featured post titles, categories, tags, meta keywords, images, etc.  

This plugin works for both the Classic and Gutenberg WordPress editors. You can use the shortcodes to display recent, related, featured, and popular posts in the Classic editor. 

You can download it from your admin plugin area or from the WordPress.org repository. Check our complete tutorial if you require help installing WordPress plugins. 

To use the plugin, simply configure the recent post display customization from the plugin setting. Choose where you want it to display. The plugin setting offers two placements – Before and after content. 

Relevant Plugin setting page

If you need to display recent posts in other places on your site, use the shortcode [bws_latest_posts]. 

Here is how the shortcode output looks when I test it.

Example of recent post using the WordPress Relevant plugin

You can customize the appearance to fit your own website branding and preference. Don’t forget, the plugin lets you customize:

  • Featured image
  • Placement.
  • Excerpt
  • Post date
  • Author
  • Reading time
  • Comment number. 

Benefits of Using Shortcodes

  • Flexibility – Shortcodes allow you to customize your recent post display to suit your specific needs.
  • Easy to use – Shortcodes are simple to implement and can be added anywhere in your theme’s templates.
  • Powerful – Shortcodes can be combined with other shortcodes and HTML to create complex layouts.

4. Manually Adding Recent Posts to Your Theme

If you have a strong understanding of PHP and WordPress development, you can manually add recent posts to your theme’s templates. 

This method offers the highest level of customization but requires more technical expertise. It lets you create stunning and unique customization for the appearance of your recent post. 

You can define most aspects, including appearance, typography, visuals, post metadata, content, etc. 

Moreover, this method is not recommended for beginners with little knowledge of how WordPress works. Or users who don’t know much about coding. 

But if you’re up to it, here is an example of PHP code to display the latest posts on your site.

<?php
$args = array(
    'post_type' => 'post',
    'posts_per_page' => 5,
    'order' => 'DESC',
    'orderby' => 'date'
);
$recent_posts = new WP_Query($args);

if ($recent_posts->have_posts()) : while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
    <div class="recent-post">
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <p><?php the_excerpt(); ?></p>
    </div>
<?php endwhile; wp_reset_postdata(); endif; ?>

This code will retrieve the five most recent posts and display them in a custom HTML structure.

Benefits of Manual Implementation

  • Complete control – You have full control over how your recent posts are displayed.
  • Flexibility – You can customize the HTML structure and styling to match your theme’s design.
  • Performance – Manual implementation can potentially improve performance, especially for large websites.

Things to consider

  • Technical expertise – Manual implementation requires a solid understanding of PHP and WordPress development.
  • Backup Your Site – First, ensure you have the most recent backup of your site. In case things go wrong, you can revert to it. You can use a plugin like JetPack VaultPress Backup or check your web host.
  • Child Theme – Consider adding the code using a child theme. When you update the parent theme, you won’t lose your customizations.
  • Maintainability – Custom code can be difficult to maintain and update over time.

If you’re comfortable with PHP and WordPress development, manually adding recent posts to your theme can provide a highly customized and efficient solution. 

However, for most users, the methods discussed in the previous sections will be sufficient. Again, don’t try modifying your theme’s code if you’re not skilled in programming languages.

Conclusion

Displaying the latest posts is a good way to drive more engagement and pageviews. The more content readers can find on your site, the better the blog’s value.

From the simple and intuitive Latest Posts Gutenberg block to the more advanced techniques of using shortcodes and manual PHP implementation, there’s a solution to fit your needs and preferences.

The important thing is to use the methods that best suit your needs and experience. Don’t overcomplicate the process; ensure you’re focusing on optimizing for user experience. 

Let me know your favorite method in the comment section.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.