Wordpress - list author comments on Author page


/ Published in: PHP
Save to your folder(s)

Thanks to @kaiser on WP answers for this.

Place this function in your functions.php file, then use it in your template with the function call like:

wpse19316_author_comments( 100 );


Copy this code and paste it in your HTML
  1. function wpse19316_author_comments( $length )
  2. {
  3. $final_length = (int) $length;
  4. $author_comments = get_comments( array( 'ID' => $GLOBALS['authordata']->ID ) );
  5. foreach ( $author_comments as $comment )
  6. {
  7. $comment_length = sublen( $comment->comment_content );
  8. $comment_excerpt = $comment->comment_content;
  9. if ( $comment_length > $final_length )
  10. $comment_excerpt = substr( $comment->comment_content, $final_length );
  11. echo $comment_excerpt.'<br />';
  12. }
  13. }

URL: http://wordpress.stackexchange.com/questions/19316/recent-comments-on-author-page

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.