Skip to content

How To Display Scheduled Posts In WordPress

If you schedule posts in your blog in advance and want to show your readers what’s coming next, here’s a snippet to display scheduled posts in WordPress. You will also get more viewers with this trick as your visitors will know when to come back for the next post. Here are two ways of doing it:

Add following PHP snippet to your page to display all your future posts:

$my_query = new WP_Query('post_status=future&order=DESC&showposts=10');
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;

We can also use this trick with a simple shortcode. Add following code to your current theme’s functions.php file:

   function future_posts_function($atts){
        'poststatus' => 'future',
        'order'         => 'DESC',
        'showposts' => 10,
    ), $atts));

    $return_string = '<ul>';
    query_posts(array('post_status' => $poststatus, 'order' => $order, 'showposts' => $showposts));
    if (have_posts()) :
        while (have_posts()) : the_post();
            $return_string .= '<li>'.get_the_title().'</li>';
    $return_string .= '</ul>';

    return $return_string;
add_shortcode('future_posts', 'future_posts_function');

Now, use [scheduled_posts] shortcode to display scheduled posts in your WordPress posts, pages or even in widgets.

Leave a Reply

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