WordPress display future / upcoming posts

Following code will display 5 future posts which are scheduled.
Code contains parameter called post_status. post status in this case is ‘future’ other than this post_status can be ‘draft’, ‘published’ and so on.

Simply add following code in you sidebar.php or anywhere you want to display future posts.

<h2>Future Posts</h2>
<ul>
<?php query_posts('showposts=5&post_status=future'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li><?php the_title(); ?><span class="date"><?php the_time('j. F Y'); ?></span></li>
<?php endwhile;
else: ?><li>No future Posts.</li>
<?php endif; ?>
</ul>

Leave a Reply

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

One Comment

  1. Nice post, comes in handy for me thanks!