Future post searching for WordPress

By | June 7, 2006

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:

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.

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

2 thoughts on “Future post searching for WordPress

  1. Shannon

    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. Shannon

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.