How to: List scheduled posts

November 11, 2008 at 4:57 pm

Here’s a good idea to make your readers visit your blog more often, or suscribe to your rss feed: What about listing the title of your scheduled posts? If you’re interested to do so, just read this recipe.

Achieving this recipe is very easy: Just paste the following code anywhere on your template where you want your scheduled posts to be listed. You can change the max number or displayed posts by changing the value of showposts in the query.

$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();
        $do_not_duplicate = $post->ID; ?> 
        <li><?php the_title(); ?></li>
    <?php endwhile;

Credits goes to Pascal Birchler for this awesome recipe!