Add recent posts to articles (with and without plugins)

Posted October 30, 2019 830 views

Friends, please help. On the site we use the lite version of Astra theme.

Task: add recent posts to articles. Now they are displayed simply, as the next and previous.

I plan to use the plugin for the solution, but find it difficult to choose:


What do you think about my choice? Can you recommend something?

It is necessary:
– ease of code
– adaptability
– performance

Perhaps there is an option to do without a plugin?

edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


I think that the easiest way of doing so is to use the WordPress Recent Posts Widget and add your recent posts to your sidebar for example.

I would not really use a plugin as WordPress comes with a built-in widget to display recent posts anyway. To enable that inside your WordPress admin, visit Appearance > Widgets and add Recent Posts widget to a sidebar.

If you prefer to d this with code, you could use something like this and add it to your theme files:

// Define your WP Query Parameters
<?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>

// Prepare your WP Query
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

// Get the Post Title with Hyperlink
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>

// Get the Post Excerpt
<li><?php the_excerpt(__('(more…)')); ?></li>

// Repeat the process and reset once it hits the limit

Hope that this helps!