Skip to main content
3 of 3
deleted 26 characters in body
Abhik
  • 2.9k
  • 2
  • 23
  • 31

First method, you are missing the second parameter for get_the_author_meta, which is the ID of the author.

Second method, you are using undefined variables.. Check this code, should get you what you want.

// Method 1
<ul class="authpcom">
    <?php
        $queried_object = get_queried_object();
        $author_email = get_the_author_meta( 'user_email', $queried_object->ID ); 

        $args = array(
            'author_email' => $author_email
        );
        $comments = get_comments($args);
        foreach($comments as $comment) :
            echo '<a href=" ' . get_permalink( $comment->comment_post_ID ) . ' " rel="external nofollow" title=" ' . get_the_title( $comment->comment_post_ID ) . ' ">' . get_the_title( $comment->comment_post_ID ) . '</a><br />' . $comment->comment_date . '<br /><li>' . $comment->comment_content . '</li>';
        endforeach;
    ?>
</ul>


// Method 2
<?php
    $comments = get_comments();
?>
<ul id="recent_comments">
<?php foreach ($comments as $comment) { ?>
<li>
    <p>
        <strong>
        <?php
            echo get_avatar( $comment->comment_author_email, '45' );
            echo strip_tags($comment->comment_author);
        ?>
        </strong>
        &nbsp;commented on <a href="<?php echo get_permalink( $comment->comment_post_ID ); ?>#comment-<?php echo $comment->comment_ID; ?>" rel="external nofollow" title="<?php echo get_the_title( $comment->comment_post_ID ); ?>"> <?php echo get_the_title( $comment->comment_post_ID ); ?></a>: <?php echo wp_html_excerpt( $comment->comment_content, 45 ); ?> (...)
    </p>
</li>
<?php }  ?>
</ul>

EDIT: (09/05/2015)

// Method 1
<ul class="authpcom">
    <?php
        $authorID = get_queried_object_id();
        $author_email = get_the_author_meta( 'user_email', $authorID ); 

        $args = array(
            'user_id' => $authorID,
        );
        $comments = get_comments($args);
        if ( $comments ) {
            foreach($comments as $comment) {
                echo '<li><a href="' . get_permalink( $comment->comment_post_ID ) . '" rel="external nofollow" title="' . get_the_title( $comment->comment_post_ID ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a><br>' . $comment->comment_date . '<br>' . $comment->comment_content . '</li>';
            }
        } else {
            echo '<li>No Comments from this Author</li>';
        }
    ?>
</ul>
Abhik
  • 2.9k
  • 2
  • 23
  • 31