I’m placing it under this line:
foreach ($comments as $comment)
This is what the whole thing looks like:
function get_recent_comments($no_comments = 6, $comment_lenth = 10, $before = ”, $after = ‘
‘) {
global $wpdb, $tablecomments, $tableposts;
$comments = $wpdb->get_results(“SELECT ID, comment_ID, comment_content, comment_author FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID ORDER BY $tablecomments.comment_date DESC LIMIT $no_comments”);
$output = ”;
foreach ($comments as $comment) {
$comment_author = stripslashes($comment->comment_author);
$comment_author_url = stripslashes($comment->comment_author_url);
$comment_content = strip_tags($comment->comment_content);
$comment_content = stripslashes($comment_content);
$words=split(” “,$comment_content);
$comment_excerpt = join(” “,array_slice($words,0,$comment_lenth));
$permalink = get_permalink($comment->ID).”#comment-“.$comment->comment_ID;
$output .= $before . ‘‘ . $comment_author . ‘: ‘ . $comment_excerpt . ‘…
$output .= ‘” title=”View the entire comment by ‘ . $comment_author . ‘”>’ . (read) . ‘‘ . $after;
}
echo $output;