Hi,
Many of the wordpress users wants to separate the comments and trackbacks in their blog. I have described one tweak – hack here for the same. First, you want to clean up your trackbacks/pingbacks by only displaying the title instead of an excerpt and everything else. For that you need to find this code in comments.php file of your theme:
<ol>
<?php wp_list_comments(‘type=pings’); ?>
Replace with:
<ol>
<?php wp_list_comments(‘type=pings&callback=list_pings’); ?>
Now, you need to add this code to functions.php file of your theme:
<?php
function list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li id=”comment-<?php comment_ID(); ?>”><?php comment_author_link(); ?>
<?php } ?>
Now, you need to fix the comment count to only show actual comments and filtering out the trackbacks/pingbacks which are included in your comment count by default. For that add this code to functions.php file.
<?php
add_filter(‘get_comments_number’, ‘comment_count’, 0);
function comment_count( $count ) {
if ( ! is_admin() ) {
global $id;
$comments_by_type = &separate_comments(get_comments(‘status=approve&post_id=’ . $id));
return count($comments_by_type['comment']);
} else {
return $count;
}
}
?>
That’s it!
Thanks,
Shane G.
Popularity: 1%