Menu Close

Show a List of Future (Scheduled) Posts in WordPress


Last week I wrote a daily trick on how to show a list of your most recently updated posts on WordPress and figured it would be nice to follow it up with a quick trick on how to show your readers a list of your scheduled posts. For those running community blogs with lots of readers/followers it would be a nice feature to show upcoming future posts to your readers to build up some excitement and get some conversations stirring up. Plus, its also a great way to get your readers opinions/inputs before the post is done so you can make it even better. So here is the code…

List Upcoming Posts Using WP_Query

Simply insert the following code where you want to display a list of scheduled posts. Note: Obviously these won’t be links 🙂

<?php $future_posts = new WP_Query(
       'posts_per_page' => 6,
       'order' => 'ASC',
       'post_status' => 'future'
 )); ?>
<?php if ( $future_posts->have_posts() ) : ?>
<h2>Upcoming Posts</h2>
   <?php while ($future_posts->have_posts()) : $future_posts->the_post(); ?>
   <li><?php the_title(); ?> - <span><?php the_time('j. F Y'); ?></span></li>
   <?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
View Source
Posted in WordPress