Menu Close

Show a List of Future (Scheduled) Posts in WordPress

default

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(
     array(
       'post_type'=>'post',
       'posts_per_page' => 6,
       'order' => 'ASC',
       'post_status' => 'future'
 )); ?>
<?php if ( $future_posts->have_posts() ) : ?>
<h2>Upcoming Posts</h2>
<ul>
   <?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; ?>
</ul>
<?php endif; wp_reset_query(); ?>
View Source
Posted in WordPress