Advertisement
hmbashar

Comment list show in author page

Sep 12th, 2015
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. global $user;
  3.     $args = array(
  4.         'user_id' => $user->ID,
  5.         'number' => 10, // how many comments to retrieve
  6.         'status' => 'approve'
  7.         );
  8.  
  9.     $comments = get_comments( $args );
  10.  
  11.     if ( $comments )
  12.     {
  13.         $output.= "<ul>\n";
  14.         foreach ( $comments as $c )
  15.         {
  16.         $output.= '<li>';
  17.         $output.= '<a href="'.get_comment_link( $c->comment_ID ).'">';
  18.         $output.= get_the_title($c->comment_post_ID);
  19.         $output.= '</a>, Posted on: '. mysql2date('m/d/Y', $c->comment_date, $translate);
  20.         $output.= "</li>\n";
  21.         }
  22.         $output.= '</ul>';
  23.  
  24.         echo $output;
  25.     } else { echo "No comments made";}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement