Re: Limit one forum to topics started today
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.