Display List of Scheduled Posts

Of the many cool features incorporated into WordPress one of the coolest has to be the ability to schedule posts for future publishing. This could come in handy if for example you are planning to be away for an extended period of time. You could write several entries beforehand then schedule them to be published at regular intervals in your absence. A great way to further enhance this is to display a list of your scheduled posts somewhere in your theme, the most logical being the sidebar.

Why do this? If you have a regular following it's a way to create a little suspense for your readers. Add the following to sidebar.php ...

<?php
$my_query = new WP_Query('post_status=future&order=DESC&showposts=5');
if ($my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
   <?php the_title(); ?>
<?php endwhile;
}
?>

This will pull the latest 5 scheduled posts from the database and display their titles. You could use a heading like "Coming Soon.."

About the author
Len has been blogging for over 10 years and is a rabid WordPress fan. In addition to blogging here you can find him writing the occasional article and toiling away in the forums at WeblogToolsCollection.com. He also hangs out at the WordPress support forums lending a hand where he can. You can also find him at his other blog LenKutchma.com

Leave a Reply

CommentLuv Enabled