DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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>

3 Comments

  1. I am struggling to get this paginating, using a custom post type.

  2. I made a couple of tweaks to this code that make it more user friendly for my site. I stripped out line 2 and used the Text Widget title to write “Upcoming posts”. I then added quotes around the post title display, added the word “on” between the title and date, and switched the date to a US-style date display.

    ” on

    No future events scheduled.

  3. I did not get post_status field , where I need to enter future word ?

Leave a Comment

Your email address will not be published. Required fields are marked *