get_results("SELECT comment_author, comment_ID, comment_post_ID, comment_content, comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $num"); echo "
\r\n"; foreach ($comments as $comment) { $commentDate = strtotime($comment->comment_date); $commentDate = date($dateFormat, $commentDate); $commentLink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; $commentTitle = get_the_title($comment->comment_post_ID); $commentAuthor = $comment->comment_author; $commentContent = nl2br(chopString($comment->comment_content, $length)); /** * This is the start of the mini-loop. Edit inside here */ ?>

By on

\r\n"; } function scomments2($num = 10, $length = 90, $dateFormat = 'Y m-d') { global $wpdb; $comments = $wpdb->get_results("SELECT comment_author, comment_ID, comment_post_ID, comment_content, comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $num"); echo "
\r\n"; foreach ($comments as $comment) { $commentDate = strtotime($comment->comment_date); $commentDate = date($dateFormat, $commentDate); $commentLink = get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; $commentTitle = get_the_title($comment->comment_post_ID); $commentAuthor = $comment->comment_author; $commentContent = nl2br(chopString($comment->comment_content, $length)); /** * This is the start of the mini-loop. Edit inside here */ ?>

By on

\r\n"; } function chopString($string, $length) { $string = strip_tags($string); if (strlen($string) > $length) { $string = substr($string, 0, $length) . '[...]'; } return $string; } ?>