Displaying Future Posts in WordPress

Posted in these categories: Tutorial

If you do like I do and schedule posts ahead of time (especially on the podcast), there’s a way inside of WordPress to show your readers what posts are coming up next:

<?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_date(); ?> - <?php the_title(); ?>
    <?php endwhile;
}
?>

This will display up to 5 “scheduled” posts wherever you drop in the code.  Add a headline <h2> tag if you want to give it a title (should you want to use it as a widget).

Want to see this code in action?  Check the WordPulse podcast page‘s sidebar to see it working!

  • Sorry, but I didn't get it... Should I insert the code into every post so that it'll display “scheduled” posts? Can I add it somewhere else so that it'll be shown automatically in every post?
  • Thanks.
  • joe
    Cool didn't know you could do that with word press posts this will save me time!
  • Nice tip, scheduling posts will save a ton of time for me, i'll be sure to try this.
  • Hey, that's awesome! I'm definitely going to implement that on my blog. Thanks so much for sharing this.
  • Thats really useful
  • The best thing about WordPress can also be the worst! You never stop learning new hacks! :)
  • Great widget to wet visitors appetites! Actually I had no idea WordPress offered Scheduling. Seems it will be really useful if you’re going on holiday but you want to keep your blog going while you’re away.
  • I think its a great idea to be able to display future posts. The question is, is there a way to not really reveal the actual title but a hint of the title to get people more curious. Of course if the post has been written already then modifying the title might screw it up. The truth is these posts are not indexed by search engines until they are published it wouldnt matter what title the post is in draft mode.
  • That is one cool wordpress hack I will definitely be adding it to a couple of my blogs :)
  • yeah , its really cool and it would help to keep the make interest and suspense in readers

    Thanks
  • That is pretty awesome... I publish a new releases post every week and it would be cool to publish just the title so that subscribers can see that it is coming....

    Thanks very much, will put this on the list of things to do.
  • Excellent tip there, there's nothing better than scheduling posts in advance, especailly with news. It's worth spending a good few hours to write some posts at the start of the month and spread them out throughout the month.
  • WordPress is still a mystery to me, I use it for a long time already, but has not yet reviewed all of its functions to the end.
blog comments powered by Disqus