Add type argument to wp_list_comments(). Make comments arg optional. Introduce separate_comments(). see #7635

git-svn-id: https://develop.svn.wordpress.org/trunk@8897 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-09-16 00:23:38 +00:00
parent b3d45e868e
commit 6f8cefd5fe
3 changed files with 54 additions and 9 deletions

View File

@@ -456,6 +456,27 @@ function check_comment_flood_db( $ip, $email, $date ) {
}
}
/**
* Separates an array of comments into an array keyed by comment_type.
*
* @since 2.7
*
* @param array $comments Array of comments
* @return array Array of comments keyed by comment_type.
*/
function &separate_comments(&$comments) {
$comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array());
$count = count($comments);
for ( $i = 0; $i < $count; $i++ ) {
$type = $comments[$i]->comment_type;
$comments_by_type[$type][] = &$comments[$i];
if ( 'trackback' == $type || 'pingback' == $type )
$comments_by_type['pings'][] = &$comments[$i];
}
return $comments_by_type;
}
/**
* Does comment contain blacklisted characters or words.
*