Magazine

How to Display Recent Posts in WordPress

Posted on the 07 April 2023 by Jitendra Vaswani @JitendraBlogger

If you want that reader must stay up to maximum time on your website/blog then provide content as per their choice.

Earlier, to decrease the “bounce rate” of the blog I have written an article on “How to Display Related Posts in WordPress without Plugin” and now if the reader wants some fresh & recent articles then Display Recent Posts in WordPress.

Mostly, we Display Recent Posts in WordPress on the sidebar but there are other users who also want some change. In this article, we will show you the different ways to Display Recent Posts in WordPress.

Display Recent Posts in list format:

We know, the list format is mostly used in sidebars so if you want to display Recent Posts in a sidebar then put the following code in a template file (sidebar.php):

', ''); ?>

I have put the default no. posts at 10, if you want some less or more posts to display then change according to your requirement.

Display Recent Posts with Summary:

To give a small overview of the post to the reader, some people display Recent Posts with a title and a short description. For them, I have found two ways to display Recent Posts.

The First Way:

  • have_posts()) : $the_query -> the_post(); ?>
  • ”>
 

If you put the above code in a template file (sidebar.php) then you have to specify a short description of the post. So, you have to rewrite the excerpt as per the word limit.

So, here is the second way to display Recent Posts in WordPress. First, you have to download this Limit Post plugin and activate it. Once the plugin is activated then paste the following code in your theme files where you want to display Recent Posts.

  • have_posts()) : $the_query -> the_post(); ?>
  • ”>
 

Here I have put the description limit as 250 you can change according to your blog.

Display Recent Posts with Full Content:

If you want to display Recent Posts with Full Content then place the following code in your theme files:

  • have_posts()) : $the_query -> the_post(); ?>
  • ”>
 

Here also you can change the no. of posts.

I hope now you can Display Recent Posts in WordPress blog easily. If you face any difficulty in placing code then connect with via the comments section below.


Back to Featured Articles on Logo Paperblog