How to: List future posts

February 21, 2009 at 2:22 pm

Do you ever wished to be able to use WordPress to list future events? This can be very useful for exemple if you’re using WordPress for a band website and like to list your future shows.

To achieve this recipe, simply paste this code where you’d like you future posts to be displayed:

<div id="zukunft">
	<div id="zukunft_header"><p>Future events</p></div>
	<?php query_posts('showposts=10&post_status=future'); ?>
	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
		<div >
			<p class><b><?php the_title(); ?></b><?php edit_post_link('e',' (',')'); ?><br />
			<span class="datetime"><?php the_time('j. F Y'); ?></span></p>
		</div>
	<?php endwhile; else: ?><p>No future events scheduled.</p><?php endif; ?>
</div>