{"id":41749,"date":"2025-09-14T22:59:37","date_gmt":"2025-09-14T19:59:37","guid":{"rendered":"https:\/\/coma.lv\/2025\/09\/14\/how-to-display-a-list-of-scheduled-posts\/"},"modified":"2025-09-14T22:59:37","modified_gmt":"2025-09-14T19:59:37","slug":"how-to-display-a-list-of-scheduled-posts","status":"publish","type":"post","link":"https:\/\/coma.lv\/en\/2025\/09\/14\/how-to-display-a-list-of-scheduled-posts\/","title":{"rendered":"How to Display a List of Scheduled Posts"},"content":{"rendered":"\n<p style=\"text-align: left;\">Showing upcoming posts can be useful for getting people to subscribe to your blog. In this post we will look at how to do it.<\/p>\n<h4 style=\"text-align: left;\">What Are Scheduled Posts?<\/h4>\n<p style=\"text-align: left;\">If you have been blogging for a while, you have probably noticed that publishing posts at a certain time can help you earn more views. If you are new to blogging, you should start by analyzing your traffic (for example, Google Analytics \/ GA4) to understand when your audience is most active.<\/p>\n<p style=\"text-align: left;\">The problem is that you cannot just sit and wait for the right time to click the publish button. That is why WordPress has a built-in mechanism for scheduling posts.<\/p>\n<p style=\"text-align: left;\">It is important to understand: by default WordPress <strong data-start=\"1016\" data-end=\"1089\">does not show visitors posts with the Scheduled status<\/strong>. They automatically become visible on the blog only at the scheduled time. But if you want to display a <strong data-start=\"1194\" data-end=\"1220\">list of upcoming posts<\/strong> (for example, a \u201cComing soon\u201d section), you can do it with a plugin or your own code. In this article we will look at both options.<\/p>\n<h4 style=\"text-align: left;\">Method One: Display Upcoming Posts with a Plugin<\/h4>\n<p style=\"text-align: left;\" data-start=\"1448\" data-end=\"1625\">Install and activate the <a href=\"https:\/\/wordpress.org\/plugins\/display-posts-shortcode\/\" target=\"_blank\" rel=\"noopener\"><strong data-start=\"1489\" data-end=\"1506\">Display Posts<\/strong><\/a> plugin. It adds a universal shortcode that lets you display posts by any parameters, including the <code data-start=\"1614\" data-end=\"1622\">future<\/code> status. Paste the following code into a post, page or Shortcode block:<\/p>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\">[display-posts post_status=<span class=\"hljs-string\">\"future\"<\/span> order=<span class=\"hljs-string\">\"ASC\"<\/span> posts_per_page=\"<span class=\"hljs-string\">5\"<\/span>]<br \/>\n<\/code><\/div>\n<\/div>\n<p style=\"text-align: left;\" data-start=\"1878\" data-end=\"1967\">This shortcode will display up to 5 scheduled posts in ascending order of publication date. (The <code data-start=\"140\" data-end=\"160\">posts_per_page=\"5\" <\/code>parameter defines the number of posts displayed. You can replace 5 with any other number to show the desired number of scheduled posts).<\/p>\n<p style=\"text-align: left;\" data-start=\"1971\" data-end=\"2101\">The list can be placed in the sidebar through a \u201cShortcode\u201d or \u201cCustom HTML\u201d block, and also inserted directly into the text of a page or post.<\/p>\n<p style=\"text-align: left;\" data-start=\"1048\" data-end=\"1077\"><strong>The Problem with Links<\/strong><\/p>\n<p style=\"text-align: left;\" data-start=\"1079\" data-end=\"1182\">By default, Display Posts creates links on post titles. For logged-in users (admin, editor, author) they work and lead to the post preview, but for non-logged-in users the links lead to a 404, since the post is not published yet.<\/p>\n<p style=\"text-align: left;\" data-start=\"1395\" data-end=\"1418\"><strong>A CSS Solution<\/strong><\/p>\n<p style=\"text-align: left;\" data-start=\"1420\" data-end=\"1592\">To make the links appear only for logged-in users and be plain text for everyone else, add the following CSS to your site&#8217;s custom CSS or to the theme:<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n.logged-out .display-posts-list a {\r\n    pointer-events: none;\r\n    cursor: default;\r\n    text-decoration: none;\r\n    color: inherit;\r\n}\r\n<\/pre>\n<div class=\"contain-inline-size rounded-2xl relative bg-token-sidebar-surface-primary\" style=\"text-align: left;\">\n<div class=\"sticky top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\"><\/div>\n<\/div>\n<\/div>\n<p style=\"text-align: left;\" data-start=\"2139\" data-end=\"2358\">For non-logged-in users, links inside <code data-start=\"98\" data-end=\"119\">.display-posts-list<\/code> become non-clickable thanks to the <code data-start=\"164\" data-end=\"177\">.logged-out<\/code> class, while logged-in users see working links. This way you can safely show the list of upcoming posts on your site without the risk of visitors landing on 404 pages.<\/p>\n<h4 style=\"text-align: left;\">Method Two: Display Scheduled Posts Manually<\/h4>\n<p style=\"text-align: left;\">If you prefer lightweight custom code without plugins, add the following code to the <code data-start=\"2258\" data-end=\"2273\">functions.php<\/code> file of your child theme or create a small custom snippet plugin.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ Add this code to your child theme&amp;#039;s functions.php or a small custom plugin\r\nfunction wpb_upcoming_posts() {\r\n    \/\/ Query for future posts\r\n    $the_query = new WP_Query( array(\r\n        &amp;#039;post_status&amp;#039;    =&amp;gt; &amp;#039;future&amp;#039;,      \/\/ Only get scheduled posts\r\n        &amp;#039;posts_per_page&amp;#039; =&amp;gt; 3,             \/\/ Limit number of posts displayed\r\n        &amp;#039;orderby&amp;#039;        =&amp;gt; &amp;#039;date&amp;#039;,        \/\/ Order by post date\r\n        &amp;#039;order&amp;#039;          =&amp;gt; &amp;#039;ASC&amp;#039;,         \/\/ Earliest posts first\r\n    ) );\r\n\r\n    \/\/ Initialize output variable\r\n    $output = &amp;#039;&amp;#039;;\r\n\r\n    \/\/ Check if there are future posts\r\n    if ( $the_query-&amp;gt;have_posts() ) {\r\n        $output .= &amp;#039;&amp;lt;ul class=&amp;quot;upcoming-posts&amp;quot;&amp;gt;&amp;#039;;\r\n        while ( $the_query-&amp;gt;have_posts() ) {\r\n            $the_query-&amp;gt;the_post();\r\n\r\n            \/\/ Escape title and date for security\r\n            $title = esc_html( get_the_title() );\r\n            $date  = esc_html( get_the_date( get_option( &amp;#039;date_format&amp;#039; ) ) );\r\n\r\n            \/\/ If user is logged in, show link; otherwise show only title and date\r\n            if ( is_user_logged_in() ) {\r\n                $permalink = esc_url( get_permalink() );\r\n                $output .= &amp;quot;&amp;lt;li&amp;gt;&amp;lt;a href=\\&amp;quot;{$permalink}\\&amp;quot;&amp;gt;{$title}&amp;lt;\/a&amp;gt; ({$date})&amp;lt;\/li&amp;gt;&amp;quot;;\r\n            } else {\r\n                $output .= &amp;quot;&amp;lt;li&amp;gt;{$title} ({$date})&amp;lt;\/li&amp;gt;&amp;quot;;\r\n            }\r\n        }\r\n        $output .= &amp;#039;&amp;lt;\/ul&amp;gt;&amp;#039;;\r\n    } else {\r\n        \/\/ Message if no scheduled posts are found\r\n        $output .= &amp;#039;&amp;lt;p&amp;gt;No upcoming posts yet.&amp;lt;\/p&amp;gt;&amp;#039;;\r\n    }\r\n\r\n    \/\/ Reset post data after query\r\n    wp_reset_postdata();\r\n\r\n    \/\/ Return the HTML output\r\n    return $output;\r\n}\r\n\r\n\/\/ Register shortcode &#x5B;upcoming_posts]\r\nadd_shortcode( &amp;#039;upcoming_posts&amp;#039;, &amp;#039;wpb_upcoming_posts&amp;#039; );\r\n\r\n\/\/ Enable shortcode execution in text widgets\r\nadd_filter( &amp;#039;widget_text&amp;#039;, &amp;#039;do_shortcode&amp;#039; );\r\n<\/pre>\n<p style=\"text-align: left;\">Now go to <strong>Appearance \u2013 Widgets <\/strong>(or the block editor), add a \u201cShortcode\u201d or \u201cCustom HTML\u201d block to the sidebar and paste this shortcode:<\/p>\n<p style=\"text-align: left;\">[upcoming_posts]<\/p>\n<p style=\"text-align: left;\"><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/coma.lv\/wp-content\/uploads\/2016\/11\/upcomingposts_shortcode.jpg\" alt=\"WordPress\" title=\"\"><\/p>\n<p style=\"text-align: left;\">Click the save button and go to the site to see the list of scheduled posts in the sidebar. You can also add this shortcode to a post, a page or a template.<\/p>\n<hr \/>\n<p style=\"text-align: left;\"><em>Our specialization is WordPress website development and maintenance. Contact us for a free consultation \u2014 <a href=\"mailto:vadim@coma.lv\">vadim@coma.lv<\/a>, <a href=\"tel:+37129394520\">+371 29394520<\/a><\/em><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>Showing upcoming posts can be useful for getting people to subscribe to your blog. In this post we will look at how to do it. What Are Scheduled Posts? If you have been blogging for a while, you have probably noticed that publishing posts at a certain time can help you earn more views. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":37660,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1225,1406],"tags":[],"class_list":["post-41749","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","category-for-beginners"],"_links":{"self":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41749","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/comments?post=41749"}],"version-history":[{"count":0,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/posts\/41749\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media\/37660"}],"wp:attachment":[{"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/media?parent=41749"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/categories?post=41749"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coma.lv\/en\/wp-json\/wp\/v2\/tags?post=41749"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}