Support » Themes and Templates » Query author’s comments
9 years, 4 months ago
Is there any way to display the author/user’s last few comments on the author template, or would it require a custom query?
Solved. My solution was to add this section of code:
<?php $querystr = "
WHERE $wpdb->comments.comment_author = '".$curauth->user_login."'
AND comment_approved = '1'
ORDER BY comment_date DESC";
$results = $wpdb->get_results($querystr, OBJECT);
foreach ($results as $comment) :
Then I added the necessary HTML interspersed with variables such as <?php echo $results[$i]->comment_content; ?>
I ended with `<?php
<?php echo $results[$i]->comment_content; ?>