'
',
'after_widget' => '',
'before_title' => '',
));
add_filter('comments_array', 'filterComments', 0);
add_filter('the_posts', 'filterPostComments', 0);
//Updates the comment number for posts with trackbacks
function filterPostComments($posts) {
foreach ($posts as $key => $p) {
if ($p->comment_count <= 0) { return $posts; }
$comments = get_approved_comments((int)$p->ID);
$comments = array_filter($comments, "stripTrackback");
$posts[$key]->comment_count = sizeof($comments);
}
return $posts;
}
//Updates the count for comments and trackbacks
function filterComments($comms) {
global $comments, $trackbacks;
$comments = array_filter($comms,"stripTrackback");
$trackbacks = array_filter($comms, "stripComment");
return $comments;
}
//Strips out trackbacks/pingbacks
function stripTrackback($var) {
if ($var->comment_type == 'trackback' || $var->comment_type == 'pingback') { return false; }
return true;
}
//Strips out comments
function stripComment($var) {
if ($var->comment_type != 'trackback' && $var->comment_type != 'pingback') { return false; }
return true;
}
?>