(+84) 463.28.7979

How to List Future “Upcoming” Posts in WordPress


One of the best feature that every beginner ought to know is the ability to schedule your posts in WordPress. But this feature can do more then letting you schedule your post to publish at a certain time, it can help you bring your readers back by telling them what to expect in a certain amount of hours. In this tutorial, we will show you how to generate user excitement by listing your future “upcoming” posts in WordPress.

First you need to schedule your posts for the future dates. Then open your sidebar.php or wherever you like to display the list of future posts, and paste the following code:

<?php query_posts(‘showposts=10&post_status=future’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<span><?php the_time(‘j. F Y’); ?></span></p>
<?php endwhile;
else: ?><p>No future events scheduled.</p>
<?php endif; ?>

The code above is being sorted by the parameter post_status which in this case is “future”, but it can be draft, published and so on. There is also another parameter in this post that limits the number of posts being displayed, showposts=10. You can change the number to however many schedule posts you want to show your users.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>