Support » Fixing WordPress » comment_excerpt help!!

  • Resolved actionbasic

    (@actionbasic)


    Hi all, I’m using this code to pull in my recent comments as I don’t use widgets and I need help adding the comment_excerpt:

    <?php
    			$number=5; // number of recent comments desired
    			$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
    			?>
    			<ul id="recentcomments">
    			<h2>Comments</h2>
    			<?php
    			if ( $comments ) : foreach ( (array) $comments as $comment) :
    			echo  '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
    			endforeach; endif;?>

    I want to add the comment excerpt right under the title of course, but I don’t know where to put it in the above code. It’s killing me. I need it be a part of the

  • . Thanks in advance!
  • The topic ‘comment_excerpt help!!’ is closed to new replies.