Skip to content

How to display an archive with all postst in WordPress?

To do this add another page template in your theme’s folder.

You could create a Page (Write > Write Page) called…,  that just uses a custom Page template implementing query_posts().

I do something similar on my site but don’t list every post! Just the categories with description and such. However, one can combine the idea of a Category Page with what I do on my ‘Archive’ Page:

Sometimes the  function wp_query(); brakes the pagination, so if this hapens use this code insted:

<?php $limit = get_option('posts_per_page'); 
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 
query_posts('showposts=' . $limit . '&paged=' . $paged); 
$wp_query->is_archive = true; 
$wp_query->is_home = false; ?>

Notes:

$limit is assigned the ‘posts_per_page’ option from your WordPress settings, but can be changed to something else if you like:

$limit = 20;

These:

$wp_query->is_archive = true; $wp_query->is_home = false;

after the query_posts() are important as they force posts_nav_link() (and so pagination) to work, along with a few other helpful results gained for fooling WordPress into thinking we’re in the archive pages.

For the $paged stuff, see:
http://wordpress.org/support/topic/57912#post-312858

For more info: http://wordpress.org/support/topic/querying-all-posts

Published inWordpress