I have an author profile page where I'm displaying a user avatar and information about the author. On this same page, I'm also trying to include posts by other authors with their avatar displayed next to their post title. The problem I'm having is that get_avatar(get_the_author_meta('ID')) is only displaying the avatar of the current profile page author and not the author of the posts within the loop. So instead of the different author avatars, I have the avatar of the current author page repeated over and over.
Here is my code:
$args = array(
'cat' => '55',
'posts_per_page' => '3'
);
$Voices = new WP_Query($args);
if ($Voices->have_posts() ) {
while ($Voices->have_posts() ) {
$Voices->the_post();
echo get_avatar(get_the_author_meta('ID'), 150);
echo '<a href="' . the_permalink() . '">' . the_title() . '</a>';
coauthors_posts_links();
}
}
wp_reset_postdata();