[wp-hackers] Allowing future posts

Joost de Valk joost at joostdevalk.nl
Sat Nov 17 19:19:38 GMT 2007


that plugin should of course be named "the future is now" :P


On Nov 17, 2007, at 7:33 PM, Kaf Oseo wrote:

> #2 is pretty trivial these days:
>
> <?php
> /*
> Plugin Name: Show Future Posts
> Description: Display all posts with a timestamp in the future.
> Version: R1
>  */
>
> function display_future_where($where) {
> 	global $wpdb;
> 		$where .= " OR $wpdb->posts.post_status = 'future' ";
> 	return $where;
> }
>
> add_filter('posts_where', 'display_future_where');
> ?>
>
> -Kaf
>
> Hacker Scot wrote:
>> I'm looking for a way to have future-dated posts go live  
>> immediately rather than waiting for their timestamp to arrive.   
>> IOTW I want posts to go live when I hit Publish  even if the  
>> timestamp is for two months from now (this is for an Events-like  
>> publishing system, but I don’t want to use an Events plugin for  
>> reasons I won’t go into).
>>  I found that if I change the post_status in wp_posts from  
>> “future” to “publish” then a future-dated post goes live. Good. So  
>> I need to write a plugin that does one of:
>> 1) When a post is submitted, don’t mark it “future” even if it is  
>> in the future, or
>> 2) When displaying the loop, don’t filter out “future” posts.
>> Which approach makes more sense / would be easier to write? Or is  
>> there another way to accomplish this that I'm not finding?
>> Thanks,
>> Scot
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list