Posted By

adambundy on 11/06/12


Tagged

wordpress author


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adambundy


Wordpress - list author comments on Author page


 / Published in: PHP
 

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

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:

wpse19316authorcomments( 100 );

  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. }

Report this snippet  

You need to login to post a comment.