Using a gravatar image within author.php
-
I run a blog with multiple authors. Recently I added a custom “author.php” template to the site, which is supposed to include an author photo, bio and all their posts. For the photo, I figured I’d use gravatars. Here’s the code I tried:
<?php while (have_posts()) : the_post(); ?> <?php echo get_avatar( get_the_author_email(), '56' ); ?> <?php endwhile; ?>
Unfortunately that outputs about 10 gravatar images, one for each post I’ve made. So I added a query_posts function with “showposts=1”, and thankfully it now displays only one gravatar — but it’s the gravatar for one of my other authors, not mine!
Any obvious coding that would get this to work correctly?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Using a gravatar image within author.php’ is closed to new replies.