OK, I think I have this one solved. I modified my forum.php file to include this block right before the $topics foreach loop.
<?php if( $forum_id == '4' ) { // If this is the "Today Only" forum (#4), replace the $topics query
$today = date('omd');
$today_topics_query = new BB_Query( 'topic',
array(
'forum_id' => 4,
'started' => $today,
'order_by' => 'topic_start_time',
'topic_status' => 'all',
'open' => 'all',
'count' => true,
'per_page' => 20
)
);
$topics = $today_topics_query->results; // Here's the array of topics the query returned.
} ?>
I’ll let you know for sure if it works tomorrow.
I found a much more elegant solution by slightly modifying some other code I found here on the forums. I created a plugin like this:
/* Plugin Name: Filter Today Only Topics */
function filter_today_only_topics($where){
$today_only_forums = array ("4"); // The id# of the Today Only forum(s)
foreach($today_only_forums as $forum) {
$where .= " AND (forum_id != " . $forum . " OR topic_start_time > CURDATE()) ";
}
return $where;
}
add_filter( 'get_latest_topics_where', 'filter_today_only_topics');
add_filter( 'get_latest_posts_where', 'filter_today_only_topics');
This has the advantage of working in any list of recent posts without modifying the templates. The counts are still wrong in the forum lists, and I can’t find a filter that let’s me change the query for just those, but I’ll just write a template function for that.