get_results("SELECT * FROM $wpdb->comments WHERE comment_date >= '$begindate' AND comment_approved = '1' ORDER BY comment_date DESC"); } function do_atom_comments() { $comments = get_recent_approved_comments(); foreach ($comments as $comment) { $post_title = get_the_title($comment->comment_post_ID); $post_link = get_permalink($comment->comment_post_ID); $comment_link = $post_linke.'#comment-'.$comment->comment_ID; $comment_date = mysql2date('Y-m-d\TH:i:s\Z', $comment->comment_date); $comment_html = $comment->comment_content; $comment_text = strip_tags($comment_html); $excerpt_lines = explode(' ', $comment_text); $dotdotdot=""; if (count($excerpt_lines) > 20) { $dotdotdot = "..."; } array_splice($excerpt_lines, 21); $excerpt = implode(" ", $excerpt_lines).$dotdotdot; echo "\n"; /* output an author even if it's completely empty */ echo " \n"; if ($comment->author != "") { echo " $comment->comment_author\n"; if ($comment->$comment_author_url != "") { echo " $comment->comment_author_url\n"; } } echo << Comment on "$post_title" $comment_link $comment_date $comment_date comment $excerpt EOT; } } add_action('atom_head', 'do_atom_comments');