Okay, I've figured it out... comments_by_type requires a strange explicit declaration, in the comments.php, as follows:
Code:
$comments_by_type = &separate_comments($comments); //strangely, this has to be declared explicitly
if ( ! empty($comments_by_type['pings']) ) { //only placed in if there are indeed pingbacks
Thus, the entire code to separate out trackbacks (be sure to select "Yes" for this in the ATA theme under comments!!) is as follows:
In the comments.php, where you find the following:
Code:
wp_list_comments(array(
'avatar_size'=>$bfa_ata['avatar_size'],
'reply_text'=>__(' · Reply','atahualpa'),
'login_text'=>__('Log in to Reply','atahualpa'),
'callback' => bfa_comments,
'type' => 'pings'
));
} else {
comment that portion out, and replace it with all of the following:
Code:
//wp_list_comments(array(
//'avatar_size'=>$bfa_ata['avatar_size'],
//'reply_text'=>__(' · Reply','atahualpa'),
//'login_text'=>__('Log in to Reply','atahualpa'),
//'callback' => bfa_comments,
//'type' => 'pings'
//));
//above commented out and this portion replaced by derek beck
$comments_by_type = &separate_comments($comments); //strangely, this has to be declared explicitly
if ( ! empty($comments_by_type['pings']) ) { //only placed in if there are indeed pingbacks
echo "<BR><h3 id='comments'>Pingbacks:</h3>";
echo "<div id='pings'>";
wp_list_comments('type=pings&callback=list_pings');
echo "</div>";
}
//end add-in
} else {
Then, in functions.php, add the following to the very bottom:
Code:
<?php
//add-in by derek beck for trackback separation
function list_pings($comment, $args, $depth) { //this function is a callback set in comments.php to check for the number of pings within the comments
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link();
}
add_filter('get_comments_number', 'comment_count', 0);
function comment_count( $count ) { //this function updates the comment count so that it does not include in the total the number of pings
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;
}
}
//end add-in
?>
That makes it work. Note with the <div id='pings'> declaration you can style the pings as you desire.
See my site below for examples in the blog entries... Hope this is useful for someone!
Derek Beck
www.derekbeck.com/1775