[wp-hackers] Allowing future posts
Kaf Oseo
kaf at szub.net
Sat Nov 17 18:33:20 GMT 2007
#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
More information about the wp-hackers
mailing list