Add “All Posts” Archive Page to WordPress Blog
For a while now, I’ve been looking for a way to list all my posts on one page, since I don’t see the point of monthly archives and I think it would be neat to have a quick reference to all previous posts. I have been unsuccessful in my search attempts until last night, when I stumbled onto the solution accidentally.
I finally found the code on WPRecipes. However, the code on the site is unformatted, so I’ll jazz it up a little bit so that it will fit your WordPress theme.
To do this, you’ll want to create a page template called “All Posts”. Open up notepad (or some text editor) and paste the following.
<?php get_header(); ?>
<div id="contentcontainer">
<div id="left">
<?php
$debut = 0;
?>
<?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<ul>
<?php
$myposts = get_posts('numberposts=-1&offset=$debut');
foreach($myposts as $post) :
?>
<li><?php the_time('d/m/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endwhile; ?>
</div><!--end:left-->
<?php get_sidebar(); ?>
</div><!--end:contentcontainer-->
<?php get_footer(); ?>
Save this as “allposts.php” (or something similar) and upload it to the “wp-content/themes/your_theme/” folder. Create a new page in WordPress and select “All Posts” as a page template from the “Attributes” menu on your right.
Publish and you’re in business!
technorati tags: posts, code, WPRecipes, WordPress, theme, page template

Hey! My name is Ryan, and I'm a 20 year old in Columbia, SC. This blog is my passion - my hobby, my stress reliever, and my frustration. Hope you enjoy!