Making Avatars appear on the index page!
-
I’m creating a blog with multiple authors, so I want to get avatars/gravatars for each user to appear on my index page of my child theme of Twenty Eleven when it displays their post.
I found that if I edit index.php, I can add the line
<?php echo get_avatar( $post->post_author, 50 ); ?>
Just after the loop, this will sucessfully add an avatar on top of the post. The only problem with this is that it also displays the admins avatar as well. Is there a way to block the admin/specific user’s avatar? below is a larger snippet of the code I use<?php if ( have_posts() ) : ?> <?php twentyeleven_content_nav( 'nav-above' ); ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php echo get_avatar( $post->post_author, 50 ); ?><?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php twentyeleven_content_nav( 'nav-below' ); ?> <?php else : ?>
PS: This method makes the avatar appear above the post. Is it possible with css to make the avater float/align left of the post? How woud I do this?
- The topic ‘Making Avatars appear on the index page!’ is closed to new replies.