Listing scheduled future posts in WordPress.

len lich bai viet tuong lai

The article discusses how to display scheduled future posts in WordPress in order to attract more subscribers. The scheduling feature in WordPress allows bloggers to list upcoming posts to optimize posting times. Two methods are provided to display scheduled posts: using a plugin or manually adding code to the functions.php file. By following the steps outlined in the article, users can easily showcase their upcoming posts in a widget on their website. The article concludes by encouraging readers to explore more about WordPress and follow the Hocwordpress Group for the latest updates.

Recently, some of you have asked me how to list scheduled future posts in WordPress. Displaying future posts has the potential to attract people to subscribe to your blog. Here’s how you can display upcoming posts in a WordPress widget.

What is scheduled post or upcoming post in WordPress?

If you have been blogging for a while or are a professional blogger, you may have noticed that publishing posts at a certain time gets you more views. If you are new to blogging and don’t know what time of day you get the most visitors, you should use Google Analytics.

The problem is, you can’t afford to waste time waiting for the right time to post. That’s why WordPress has a built-in scheduling feature. It allows you to list future posts to make it easier for you to post.

See also  How to rearrange WordPress pages with drag and drop functionality

Using calendar creation, you can focus on publishing and managing your posting schedule effectively.

Let’s take a look at 2 ways to display scheduled posts in WordPress and get more views in the future.

Method 1: Display scheduled posts using a plugin

First, install and activate the plugin SOUP – Show off Upcoming Posts. Check out our step-by-step guide on how to install a WordPress plugin.

After activation, go to Appearance >> Widget. You will find the ‘Upcoming Posts’ widget in the list of available widgets. Just add the widget to your widget where you display scheduled posts.

The widget settings allow you to choose how many scheduled posts you want to display. You can also display dates next to them, link to your RSS feed, or link to a page where users can sign up for your email list. Click the save button to save your widget settings. You can now visit your website to see the widget in action.

Method 2: Display scheduled posts or future posts manually

Add this code to the functions.php file in your website’s theme or child theme:

function hocwp_upcoming_posts() { 
    $the_query = new WP_Query(array( 
        'post_status' => 'future',
        'posts_per_page' => 3,
        'orderby' => 'date',
        'order' => 'ASC'
    ));
    if ( $the_query->have_posts() ) {
        while ( $the_query->have_posts() ) {
            $the_query->the_post();
            $output .= get_the_title() .' ('.  get_the_time('d-M-Y') . ')';
        }
    } else {
        $output .= 'No posts planned yet.';
    }
    wp_reset_postdata();
    return $output; 
} 
add_shortcode('upcoming_posts', 'hocwp_upcoming_posts'); 

Now, access Appearance >> Widget. Add a text widget to your sidebar and add this code [upcoming_post] inside the widget. Click the save button to save your widget settings.

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

See also  How to add a class to a WordPress menu in just a few simple steps

Epilogue

I hope this helped you understand how to display future posts in WordPress. If you find it interesting, you can follow the basic WordPress section to learn more new knowledge. Follow the fan page to receive the latest articles: Hocwordpress Group.

Rate this post

Related posts