Last week, we shared a daily trick on how to display a list of your most recently updated posts on WordPress. This week, we’re back with another quick trick that will help you show your readers a list of your scheduled posts. If you run a community blog with a large following, this feature can be a great way to build excitement and get conversations started. Additionally, it allows you to gather your readers’ opinions and input before publishing the post, making it even better.
To display a list of your scheduled posts, simply insert the following code where you want it to appear. Please note that these will not be links.
$future_posts = new WP_Query(
‘post_type’ => ‘post’,
‘posts_per_page’ => 6,
‘order’ => ‘ASC’,
‘post_status’ => ‘future’
have_posts() ) : ?>
have_posts()) : $future_posts->the_post(); ?>
This code uses WP_Query to retrieve a list of your scheduled posts. It specifies that only posts with a post_status of “future” should be included in the list. The code also limits the number of posts displayed to six and orders them in ascending order.
The while loop then iterates through each post and displays its title and scheduled publication date in a list item. Finally, the code checks if there are any scheduled posts to display and resets the query.
By using this code, you can easily show your readers a list of your upcoming posts and build excitement for your content. Additionally, gathering feedback from your readers before publishing can help you improve the quality of your posts and engage your audience even more.