close
listfutureposts

Users want to know how they can list schedule or future upcoming posts in . This can be helpful for users to subscribe to your blog. This article will show do that.

What is Scheduled or Future Upcoming Posts in WordPress?

If you are blogging for a while now you must’ve noticed that publishing posts on certain times gets more people to read it.  If you are new to blogging and don’t know what time you get the most visitors, then you should start using Google Analytics to track this information.

You are not always available to publish each post yourself so to cater that WordPress comes with a build in scheduling feature. It allows you to schedule your posts to be published later.

Using scheduling you can focus on creating content and managing your editorial calendar like a pro.

Method 1: Showing Scheduled or Future Posts with Plugin

Install and activate the SOUP – Show off Upcoming Posts plugin.

Once activated you need to visit Appearance » Widgets page. There you will find ‘Upcoming Posts’ widget under the list of available widgets. Simply add the widget to your sidebar where you to display scheduled posts.

upcomingposts_shortcode

The widget settings allow you to choose the number of scheduled posts you want to show. You can also show dates next to them, link to your RSS feed, or link to a page where users can signup for your email list.

Click on the save button to store your widget settings.

You can now visit your website to see the widget in action.

uppreview

Method 2: Showing Scheduled or Upcoming Posts Manually

Simply add this code to your theme’s functions.php file or a site-specific plugin.

01function wpb_upcoming_posts() {
02    // The query to fetch future posts

 

03    $the_query = new WP_Query(array(
04        ‘post_status’ => ‘future’,

 

05        ‘posts_per_page’ => 3,
06        ‘orderby’ => ‘date’,

 

07        ‘order’ => ‘ASC’
08    ));

 

09 
10// The loop to display posts

 

11if ( $the_query->have_posts() ) {
12    echo ‘<ul>’;

 

13    while ( $the_query->have_posts() ) {
14        $the_query->the_post();

 

15        $output .= ‘<li>’ . get_the_title() .’ (‘.  get_the_time(‘d-M-Y’) . ‘)</li>’;
16    }

 

17    echo ‘</ul>’;
18 

 

19} else {
20    // Show this when no future posts are found

 

21    $output .= ‘<p>No posts planned yet.</p>’;
22}

 

23 
24// Reset post data

 

25wp_reset_postdata();
26 

 

27// Return output
28 

 

29return $output;
30}

 

31// Add shortcode
32add_shortcode(‘upcoming_posts’, ‘wpb_upcoming_posts’);

 

33// Enable shortcode execution inside text widgets
34add_filter(‘widget_text’, ‘do_shortcode’);

 

Now you can visit Appearance » Widgets page. Add a text widget to your sidebar where you want to display upcoming posts and add this shortcode inside the widget.

[upcoming_posts]

upcomingposts_shortcode

Click on the save button to store your widget settings.

You can now visit your website to see the upcoming scheduled posts in your sidebar. You can also use this shortcode in a post, page, or a template in your child theme.

 

 

 

Tags : wordpressWordPress how to
Nooruddin Ahmed

The author Nooruddin Ahmed

An avid football fan. Lives for the weekend game.Aviation enthusiast. Believes in letting bygones be bygones.

Leave a Response