wordpress-logo-shineWhen you have completed a post in WordPress, you have the ability to save it as a draft, publish it immediately or schedule a future date when it will be published automatically. This is extremely helpful if you want to plan ahead or if you use your WP site for events. Creating a simple list of upcoming posts lets your visitors know what they can look forward to and is pretty simple to do.

The following code can be placed in your sidebar on within any template.

$futurePosts = new WP_Query();

if ($futurePosts->have_posts()) : while ($futurePosts->have_posts()) :
<li><?php the_title(); ?><br /><small><?php the_time(get_option('date_format')); ?></small></li>
<?php endwhile; else: ?>
 <li>No upcoming events.</li>
<?php endif; ?>

If you want to only display future posts from a specific category, you can add a cat=$id to the query like so:


Be sure to change the “12” to the category ID.