List all of Your Site’s Posts

Posted on April 30th, 2011

If the default wp_get_archives(type=postbypost&limit=) function doesn’t provide enough flexibility to meet your needs, here is another way to list all of your site’s posts:

<?php while(have_posts()) : the_post(); ?>
	<?php $allposts = get_posts('numberposts=-1&offset=0'); foreach($allposts as $post) : ?>

	<li><?php the_time('d/m/y'); ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

	<?php endforeach; ?>
<?php endwhile; ?>

In place, that code will display a list of all of your blog’s posts. As a bonus, you may use any of the applicable parameters available to the get_posts() function to do just about anything you need with your posts list.