How to Show All WordPress Posts on Single Page

WordPress has a built in Archive page that shows the list of posts according to tags, category, author and date. However this default archive page shows the limited list of posts, that have to meet certain criteria to be displayed. A category archive page will have posts of certain category only. Archive page for a certain author will have post of that author only. Similarly the archive page for popular post or latest post display the post that are popular or latest. But what if we want to display all of our post in one page without missing out a single one. This article shows how to show all WordPress posts on single page.

Reasons you should have an archive page
  • Archive page helps the visitors to find any posts they are interested in. Readers can browse old posts easily ,read more blog posts and learn more about specific topic.
  • Archive page can significantly increase your number of views in the page. Visitors get more contents to explore. Thus, it can also increase the amount of time a visitor spends on your site.
  • Archive page can increase the number of subscribers and customers. Archive page can engage visitors for longer time. The longer someone stays in your site, the more chances of them buying any product or signing up in your website.

How to Show All WordPress Posts on Single Page

There are different ways to display all WordPress posts on single page.

Using Display Post Shortcode Plugin

This is the easiest method for creating archive page. Here are the steps:
1. Install Display Post Shortcode plugin from the WordPress repository
How to Show All WordPress Posts on Single Page2. Activate the Plugin. You don’t have to do anything else since there are no settings to configure for the plugin.
3. Now create a new page and name it archive.php or any give any name of your choice.
4. Now paste the shortcode in the page.

[display-posts posts-per-page=”1000” order=”DESC”]

Here post_per_page gives the maximum number of post to be displayed in the page. And order is the display order which can be set to ASC or DESC to display older first or newer first post respectively. Similarly you can also display excerpts, thumbnails and other info along with the post list using shortcode.various other feature like displaying according to category  can be done check

After you publish the page, you can see the of all your posts in the single page that you created.

Using template code to display all your WordPress posts on one past.

This method  requires the knowledge of HTML, CSS and PHP. This method is recommended for advance users only.

1. Creating Custom page template
To create a custom page template open new file in notepad. Now add following line of codes in the top

<?php /* Template Name: New-custom */ ?>

Save it with any name you like. Here we have named the template file as New-custom.php. Upload the file in your current theme folder. Your current theme should be located in /wp-content/themes/ directory.

Also Read:   Setup Contact Form 7 Plugin in WordPress

2. Creating a new page in the Page Template
Login to your WordPress admin dashboard. Create a new page. On the page editing screen search for ‘Page Attribute’ section. In this section select the drop down list under the Template heading. If everything is correct you should see your new template name in the drop down menu.

How to Show All WordPress Posts on Single Page

Now select the template and publish a new page.

3. Editing the page
You have to copy the entire code from page.php and paste it to your template file that was previously created. You are free to customize the template in any way you want. Now, you can visit the page you created using custom page template.

4. Displaying All WordPress Posts
In the template file you can add the following code that will help you to display list of all posts in the same page.

// the query
$wpb_all_query = new WP_Query(array('post_type'=>'post', 
'post_status'=>'publish', 'posts_per_page'=>-1));

if ( $wpb_all_query->have_posts() ) :
        <!-- 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 -->
	<?php wp_reset_postdata(); ?>

<?php else : ?>
	<p><?php _e( 'Sorry, no posts to display.' ); ?></p>
<?php endif; ?>

The code is using a loop to display all the post. Now you have a have custom Archive page that you can link to your website to display the list of all the post in single page.

The following two tabs change content below.

Kantiman Bajracharya

Kantiman Bajracharya is a freelance web developer. He is a computer geek who has a Bachelor’s degree in Computer Engineering. He has earned lots of satisfied customers while working for numerous successful projects. He is also a WordPress theme creator and web article writer. On free time he likes reading philosophy books, traveling and playing chess.

Share This Post