Are you looking for a way to display a list of future posts to be published? While there’s probably a plugin for this, we have created a quick code snippet that you can use to display future posts in WordPress.
Instructions:
All you have to do is add this code to your theme’s index.php file:
<div id="zukunft"> <div id="zukunft_header"><p>Future events</p></div> <?php query_posts('showposts=10&post_status=future'); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div > <p class><b><?php the_title(); ?></b><?php edit_post_link('e',' (',')'); ?><br /> <span class="datetime"><?php the_time('j. F Y'); ?></span></p> </div> <?php endwhile; else: ?><p>No future events scheduled.</p><?php endif; ?> </div>
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 8 best WordPress review plugins to boost online revenue and how to set up Google Analytics eCommerce tracking for WooCommerce.
Comments Leave a Reply