Future post searching for WordPress


I am setting up a new WordPress blog, 2.0.3, for another site. This site is using EventCalendar 3.0 and will have future scheduled posts that represent events. However WordPress doesn’t have this option built in from what I can see and a quick search yielded no results.

I did a few searches and finally opened up classes.php, goto ~590 to find this:

1
2
3
4
if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
$where .= " AND post_date_gmt <= '$now'";
$distinct = 'DISTINCT';
}

Replace it with this code.

1
2
3
4
5
6
if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
if (empty($q['s'])){
$where .= " AND post_date_gmt <= '$now'";
}
$distinct = 'DISTINCT';
}

Bingo! Now on your search pages future posts are displayed!

You can see this in effect at www.austinpublic.com

  1. #1 by Shannon - July 18th, 2006 at 21:12

    Sosuke-
    You are my HERO with this post.

    I looked at austinpublic.com and noticed that (besides search) your category menu also lists only future events. Can I ask how you did that?

    Thanks.

  2. #2 by Shannon - July 18th, 2006 at 21:15

    D’ph, just read the post after this one and now I see how you did it. Anyway- you rock!

(will not be published)
  1. No trackbacks yet.