Title: List recent comments from all posts
Last modified: August 20, 2016

---

# List recent comments from all posts

 *  [ScottyChoc](https://wordpress.org/support/users/scottychoc/)
 * (@scottychoc)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/list-recent-comments-from-all-posts/)
 * I’m using the Starker’s html5 theme and there is a widget that lists the 5 most
   recent comments from all posts on the site. I would like to hard code this feature
   into a new page and I can’t seem to figure out the code.

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/list-recent-comments-from-all-posts/#post-2930566)
 * are you familiar with page templates?
    [http://codex.wordpress.org/Pages](http://codex.wordpress.org/Pages)
 * get_comments()
    [http://codex.wordpress.org/Function_Reference/get_comments](http://codex.wordpress.org/Function_Reference/get_comments)
 * also, the code of the ‘recent comments widget’ is in /wp-includes/default-widgets.
   php about line 620;
    the essential code there is:
 *     ```
       $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );
       		$output .= '<ul id="recentcomments">';
       		if ( $comments ) {
       			foreach ( (array) $comments as $comment) {
       				$output .=  '<li class="recentcomments">' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
       			}
        		}
       		$output .= '</ul>';
       ```
   
 * hope this helps 😉
 *  Thread Starter [ScottyChoc](https://wordpress.org/support/users/scottychoc/)
 * (@scottychoc)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/list-recent-comments-from-all-posts/#post-2930567)
 * Thanks so much for the quick response! I will get to work on this…

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

The topic ‘List recent comments from all posts’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [ScottyChoc](https://wordpress.org/support/users/scottychoc/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/list-recent-comments-from-all-posts/#post-2930567)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
