- While working with WordPress there are number of incidences when we need to display all the posts to in a single page.
- In fact displaying post is the basic task in any WordPress website.
- So in this article we will learn how to display all our WordPress posts on a single page.
- WordPress is a nice CMS that offers multiple ways to accomplish our task easily.
- Here, we will look at some of the methods to display all posts in a single page.
- Please kindly note this method does not include pagination. Means all post are displayed without pagination.
- If you want to display all posts with pagination, simply read our article for the same.
When to Display All Posts on a Single Page?
- WordPress has built in archive pages for each category, tags, author, and date but majority of the blog owners create their own custom archives page for their site that shows a list of popular posts, date wise archive, category list or something like that.
- Some blogs simply display a list of all their WordPress clickable post titles on one page so that user can click on the post title to read it.
Showing All Posts on a Single Page
- As we said before, number of alternatives are available to display all posts on a single page such as:
- Using a blog page
- Using a shortcode
- Using a plugin
- Using a custom template and loop.
In this article, we will try to cover all three methods step by step.
Method 1: Uisng a blog Page
- This is the easiest method to show all posts in a single page.
- It involves neither any plugin nor coding to do so.
- By default WordPress puts all the posts into the blog archive so to display all the posts on a single page all you need to do is simple create a new page with and call it “blog” page.
- Do not write anything on that page. Include that blog page on your navigation menu and you are done!
- When you click on the blog page on the navigation menu it will show all posts automatically.
Method 2: Using Posts Shortcode Plugin
- First thing you need to do is install and activate the Display Posts Shortcode For more details, read our article on how to install a WordPress plugin.
- This plugin does not require any settings to configure.
- First of all create a new page and call it Archives or anything you like.
- After that, paste the following shortcode in your page.
[display-posts posts_per_page="1000" order="DESC"]
- This shortcode will simply display a list of all your post titles in a chronological order.
- In our example, it is set to display maximum 1000 posts per page but you can change it as per your requirement.
- You can also change the post order to ASC which will display posts in a reverse chronological order (i.e. older posts first).
- It also allows showing excerpts, thumbnails, and other related information but normally, I don’t recommend doing that.
- To limit page size, it is enough to display only post titles for each post as a link rather than displaying full post.
- You can refer to their documentation page for detailed instructions.
Method 2: Using Plugin
- There are number of plugins available on the WordPress website that can be used to display your post with different criteria in variety of ways without writing a single line of code.
- You can visit the official website of the WordPress and search for the specific plugin that meets your criteria.
- Some examples are Simple Yearly Archive, Advanced Post List , Posts Listing, WordPress Posts Listing Plugin, WP Alphabet Listing Plugin, W4 Post List
- Here we will look at Simple Yearly Archive plugin.
- Displaying all WordPress posts on a single page can make it too long to scroll.
- To fix that we can display all post in a yearly-based list where user can click on specific year to see all the posts published to that year.
- Yearly Archive is a simple and easy to use WordPress plugin that allows you to display your archives in a year-based list.
- Its working mechanism is mostly like the usual WP archive, but displays all published posts separated by their publishing year.
- It also allows displaying posts from certain categories, and much more.
- First you need to install and activate the Simple Yearly Archive
- After installing, go to the plugins option under your WordPress DashBoard and click on installed plugins
- It will show a list of all installed plugins. Find out Simple Yearly Archive plugin and click on Activate
- Now go to Settings » Simple Yearly Archive page to configure plugin settings as shown in below image.
- It allows you to display list of posts in a variety of ways. You can show them all under links to yearly archives, or you can show them under collapsible years.
- If you want to display them under collapsible years, then you need to add <div> and </div> next to the option ‘Before / After (Year headline)’.
- Rest of the plugin options is self-explanatory so just play around with different options to meet your requirement.
- When you done click on “Update options” to save changes you have done.
- Now to display all your posts on a page, simply add [SimpleYearlyArchive] shortcode to the page you wish to display posts.
- The plugin offers a variety of parameters that can be used with the shortcode. Refer plugin’s documentation page for complete description on list of parameters .
Method 3: Using Custom Page Template
- Although displaying posts using plugin is the easiest way, there are circumstances in which you may want to do it with custom page templates.
- Using custom page template is also good for website performance since it minimize the plugin load.
First create a custom page template and copy the default styling from your page.php template file.
- After that, copy and past the following code to display all posts in one page.
<?php if ( have_posts() ) : ?> <ul> <!-- the loop --> <?php while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> <!-- end of the loop --> </ul> <?php else : ?> <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> <?php endif; ?>
- The above code simply displays list all post titles. You can click on it to read full post.
- If you wish to display full post instead of clickable title, just add
<?php the_content(); ?> below the <li><a href="<?php the_permalink(); ?>"><?php the_title();?></a></li>
We hope this article would be helpful to you. If so, please like and share.