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?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
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:
<ul>
// 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
<?php
endwhile;
wp_reset_postdata();
?>
</ul>
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.