futurePostInfo

This plugin allows you to easily display the date of the next post that is in the future and is published, and the number of posts in the future that are marked as published. Example usage might be the following for an “upcoming” blurb on a site:

<div id="newsbox"> 
Status: as of 
<?php 
        print date("l, F j, Y [g:i A T (O \\G\\M\\T)]"); 
?> 
<br /> 
<?php 
        $numSoon = numberOfFuturePosts(0); 
        if ($numSoon > 0) { 
                ?>The next comic is scheduled for <?php 
                dateOfNextFuturePost(); ?>.<?php 
                if ($numSoon > 1) { 
                        ?><br />The next<?php 
                        print ($numSoon - 1)." comics are on queue as well."; 
                }; 
        } else { 
                ?>The next comic is not yet ready.<?php 
        }; 
?> 
</div> 

(as of 2004-08-10, the above code is used on http://www.thechroniclesofa.com/ )

So, as you can see, there are two functions:

  • numberOfFuturePosts($printIt=1)
  • dateOfNextFuturePost($printIt=1)

Their arguments should be pretty self-explanatory – if no argument or a non-zero argument is passed, the value is printed out. If zero is passed in as an argument, the value is not printed out – in either event, it is returned as a string. dateOfNextFuturePost() returns/prints not just the date, but the time as well, separated by a space, using the default date/time format settings configured from within WordPress.

The code for the plugin can be found at https://www.andrewsw.com/text/futurePostInfo.txt rename it so it ends in .php and put it in your wp-content/plugins directory. Activate it from within the plugins administration interface that is part of WordPress and you should be good to go to use those functions in your templates.