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: , , , , ,

  • Digg
  • Facebook
  • Google
  • TwitThis
  • del.icio.us
  • StumbleUpon
  • Technorati
  • Mixx
  • E-mail this story to a friend!
  • Print this article!

Related posts:

  1. Add Author Image (Gravatar) to Posts
  2. Installing WordPress on Byethost
  3. Embed RSS Feeds in WordPress
  4. Speed Up WordPress Blogging with HTML
  5. Install WordPress on Your Desktop!

Enjoy the post? Encourage me by subscribing to the feed, following me on Twitter, and becoming a fan on Facebook. Cheers!