Title: recent comments widget
Last modified: August 18, 2016

---

# recent comments widget

 *  [sef125](https://wordpress.org/support/users/sef125/)
 * (@sef125)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/recent-comments-widget-1/)
 * I’m trying to modify the recent comments widget (not plugin) so that it shows
   the comment_excerpt and not the author or name of the blog. I can’t seem to get
   the text to show up after trying many variations. I’m kinda new to this, and 
   appreciate any insight anyone can give me. Here’s my code:
 * function widget_recent_comments($args) {
    global $wpdb, $comments, $comment; 
   extract($args, EXTR_SKIP); $options = get_option(‘widget_recent_comments’); //
   $title = empty($options[‘title’]) ? __(‘Recent Comments’, ‘widgets’) : $options[‘
   title’]; $comments = $wpdb->get_results(“SELECT comment_ID, comment_post_ID FROM
   $wpdb->comments WHERE comment_approved = ‘1’ ORDER BY comment_date_gmt DESC LIMIT
   5”); ?>
 *  <?php //echo $before_widget; ?>
    <?php //echo $before_title . $title . $after_title;?
   > <ul id=”recentcomments”><?php if ( $comments ) : foreach ($comments as $comment):
   echo ‘<li class=”recentcomments”>’ . sprintf(__(‘%1$s’), ‘comment_post_ID) . ‘#
   comment-‘ . $comment->comment_ID . ‘”>’ . get_comment_excerpt($comment->comment_ID).‘‘).”;
   endforeach; endif;?> <?php //echo $after_widget; ?> <?php }

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [sef125](https://wordpress.org/support/users/sef125/)
 * (@sef125)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/recent-comments-widget-1/#post-649927)
 * It might help to add that I’m only missing the text that should be linked, the
   excerpt of the comment.
 * thanks to anyone who can help! 🙂
 *  [dahdi](https://wordpress.org/support/users/dahdi/)
 * (@dahdi)
 * [18 years ago](https://wordpress.org/support/topic/recent-comments-widget-1/#post-650233)
 * I’m trying to figure out the exact same thing.
    I would like to know where do
   you go to edit the widget. I’m using 2.5.1

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘recent comments widget’ is closed to new replies.

## Tags

 * [widgets](https://wordpress.org/support/topic-tag/widgets/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [dahdi](https://wordpress.org/support/users/dahdi/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/recent-comments-widget-1/#post-650233)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
