Introduction
Have you ever wanted to display popular posts on a page so that website visitors can easily grasp the trending content? If that’s what you’re looking for, we’ll help you do it with specific instructions in today’s blog. We are here to bring you 3 methods to display WordPress list posts on a page. They are using a plugin, shortcode, and a custom template. So, all you need to do is explore the following guides and choose the most suitable one to implement for your site. Now, let’s take a look!
Three methods to display WordPress List Posts
Using shortcode plugin
First of all, you need to install the Display Posts plugin – one of the most useful WordPress Popular Post Plugins. Now, on the admin dashboard, let’s access Plugins -> Add New, then enter the name of the plugin on the search bar.
After that, choose the first plugin, click on the Install Now -> Activate button.
The next step you need to do is go to Pages -> Add New to generate a new page with an optional title. In the image below, we enter Archives for the title box. Then, you simply add the following shortcode to the page:
[display-posts posts_per_page="1000" order="DESC"]
Don’t forget to click on Publish button on the right of the screen.
Now, this shortcode will support you to display WordPress list posts. However, let’s note that this shortcode is customized to allow the display of up to 1000 posts per page. If you want to change this number, simply edit the number 1000 on the shortcode to whatever number you want.
Now, let’s see what all the posts appear on one page. The visitors can access any post by clicking on the title.
Utilizing Simple Yearly Archive plugin
If you hope to showcase all your posts on a page by year, it’s a good idea for you to choose the Simple Yearly Archive plugin – one of the most powerful WordPress Archive Plugins.
Firstly, let’s install and activate this plugin by opening Plugins -> Add New, then typing the plugin’s name on the search bar. Finally, you just need to click on Install Now -> Activate.
Now, let’s go to Settings -> Simple Yearly Archive to customize the archive output. There are many options for you to display the posts.
If you hope to showcase them under collapsible years, all you need to do is tick the box next to the Collapsible Years option. In addition, don’t forget to add <div> and <div> at the Before/ After (Year headline) option.
The next step, of course, is pressing the Update options button to save all your settings.
Now, in order to display WordPress list posts on a single page, you simply need to add the shortcode below to the page you want:
[SimpleYearlyArchive]
Using a custom template and loop
Besides using plugins to display WordPress list posts on one page, you are able to do that by adding code.
First of all, you need to generate a custom page template. After that, from your page.php file, let’s copy the styling. And the last step, all you need to do is utilize the following loop so that all the posts can be displayed on a page:
<?php
// the query
$wpb_all_query = new WP_Query(array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1)); ?>
<?php if ( $wpb_all_query->have_posts() ) : ?>
<ul>
<!-- the loop -->
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<!-- end of the loop -->
</ul>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
Wrap Up
All in all, with the blog we share today, we hope that it will be useful for you as well as your website. If you have any difficulty or trouble related to this topic, don’t hesitate to share it with us because we may help you solve your problem. What’s more? There are a lot of interesting and Free WordPress Themes here, let’s explore them and get the best one for your site!
- What are joomla tags and how are the used? - November 3, 2024
- Why and how to create hidden menu items in Joomla? - October 31, 2024
- How to publish smartslider 3 to joomla 4? - October 31, 2024
Recent Comments