Howdy folks,
On CSS-Tricks I have comments on articles set to shut off after 2 months (or something like that). That is a global setting from the Admin area.
This also affects how long comments are open on Pages. For example, my screencasts use a special page template, which also includes templates. I am fine with closing comments on those after 2 months as well.
But then there are my "snippets", which use a different special page template. For THOSE, I'd like to leave comments open forever.
Anyone have a solution for that?
-Chris
Dan Davies answers:
There was a hack pre-2.7 that enabled you to disable your comments after a certain amount of time had passed - so with a bit of editing it might help you:
<?php
function close_comments( $posts ) {
if ( !is_category('snippets') ) { return $posts; }
if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 60 * 24 * 60 * 60 ) ) {
$posts[0]->comment_status = 'closed';
$posts[0]->ping_status = 'closed';
}
return $posts;
}
add_filter( 'the_posts', 'close_comments' );
?>
Max answers:
Have you tried this?
[[LINK href="http://wordpress.org/extend/plugins/extended-comment-options/"]]Extended comment[[/LINK]]