Advertisement

Show future posts in Wordpress 2.3+

To enable Wordpress to show and publish future posts…BEFORE creating future posts (or if you have already created posts – reedit the timestamp in Admin > Manage > Posts). In the file /wp-includes/post.php look for the section:

if ( 'publish' == $post_status ) {
  $now = gmdate('Y-m-d H:i:59');
  if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
 $post_status = 'future';
 }

change this to:

if ( 'publish' == $post_status ) {
  $now = gmdate('Y-m-d H:i:59');
  if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
 //hack to show future posts
 $post_status = 'publish';
 }

That worked for me on Wordpress 2.3.3

Tags: , , ,

12 Responses to “Show future posts in Wordpress 2.3+”

  1. Skippy Says:

    It works, but generally you should not modify core WP files or you’ll run into trouble when it’s time to upgrade.

    Here’s a 1-line solution which you can put in your theme in index.php and archive.php. Add it at the top:

    query_posts($query_string.’&post_status=publish,future’);

  2. Jason Says:

    Skippy’s solution will display the post on the index and archive pages, but it will not allow the post to be viewed directly from the single.php template. That is the problem I’m running into.

  3. using wordpress as a calendar for the future - WebProWorld Says:

    [...] Re: using wordpress as a calendar for the future If you haven’t already come across this: Arkytek Ltd :: Blog

  4. Johan Says:

    Hi!

    Is this a solution to actually show future posts in Wordpress? I want to be able to show future posts and use Wordpress as an event/calender publishing system, found a plugin called “eventcalendar” but it doesn’t seem to work in WP2.5.

    Skippy: Im not that good in php, could you explain exactly where in the code to place your solution?

  5. mores Says:

    thanks skippy, your solution was just what I needed. And I don’t need to view future posts in full in my layout, just a mention.
    Excellent, thank you very much!

  6. Michael Says:

    Excellent work .. thanks for this. cheers

  7. ems Says:

    this does not work for me :(

  8. mores Says:

    Well guess what … I now need to show future posts in single view – sort of an event based system.
    Any solutions on fixing the bug where you can’t view detailed future posts?

  9. mssmotorrd Says:

    It’s the first time I commented here and I must say you share us genuine, and quality information for bloggers! Good job.
    p.s. You have a very good template for your blog. Where did you find it?

  10. adadmin Says:

    I use wordpress and created a template from the default theme, thanks for your comment

  11. ugi Says:

    try this guys: http://webdemar.com/wordpress/display-future-posts-in-your-wordpress-theme/

  12. Stanley Dumanig Says:

    I have the same problem on future posts not displaying on single post template(single.php) but I created my own plugin to fix this. NO hacks and NO need to edit your templates. Just install it and it solves the problem.

    Check: http://wordpress.org/extend/plugins/show-future-posts-on-single-post/

    Running example is at http://www.FredRadio.com

Leave a Reply


Bad Behavior has blocked 3652 access attempts in the last 7 days.