WordPress.org

Ready to get started?Download WordPress

Forums

Making Avatars appear on the index page! (2 posts)

  1. fabtigger
    Member
    Posted 2 years ago #

    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?

  2. fabtigger
    Member
    Posted 2 years ago #

    Hmmm... I can't seem to figure this out. Does anyoe know how I can exclude showing the admin avatar with the code above. Or perhaps has a better method of doing what I'm attempting! I've search the forums but can't find any examples.

Topic Closed

This topic has been closed to new replies.

About this Topic