<?php
function get_recent_comments($limit 10) {
     global 
$wpdb$tablecomments$tableposts;
     global 
$siteurl$blogfilename;
     
$comments $wpdb->get_results("SELECT ID, comment_ID, post_title, comment_author, comment_date FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID ORDER BY $tablecomments.comment_date DESC LIMIT $limit");
     
$output '';
     function 
sort_by_ID($a$b){
          if( 
$b->ID == $a->ID ){
               return 
$b->comment_ID $a->comment_ID;
          }
          return 
$b->ID $a->ID;
     }
     
usort($comments"sort_by_ID");
     
$new_post_ID = -1;
     foreach (
$comments as $comment) {
          if (
$comment->ID != $new_post_ID) { // next post
               
if ($new_post_ID != -1) { $output .= "\t</ul>\n</li>\n"; } 
               
$post_title stripslashes($comment->post_title);
               
$permalink "$siteurl/$blogfilename?p=$comment->ID&amp;c=1";
               
$output .= "<li>";
               
$output .= "<a href=\"$permalink\">$post_title</a>\n";
               
$output .= "\t<ul>\n";
               
$new_post_ID $comment->ID;
          }
          
$comment_date mysql2date('m/d@H:i'$comment->comment_date);
          
$comment_author stripslashes($comment->comment_author);
          
$output .= "\t\t<li>$comment_date - $comment_author </li>\n";
     }
     
$output .= "\t</ul>\n</li>\n";
     echo 
$output;
}
?>