WordPress.org

Support

Support » Themes and Templates » How to display author image in author.php?

How to display author image in author.php?

  • I am using author.php to display some information about my authors. I know that I can only use below user data from database:

    $curauth->user_aim;
    $curauth->user_email;
    $curauth->user_firstname;
    $curauth->user_icq;
    $curauth->user_lastname;
    $curauth->user_level;
    $curauth->user_login;
    $curauth->user_msn;
    $curauth->user_nickname;
    $curauth->user_description;
    $curauth->user_url;
    $curauth->user_yim;

    I’m using user_nickname; and user_description; to display author name and Bio, I also use a loop to show the list of author’s posts BUT how can I add author image??? In 2.7 you cannot provide any image for your users. Is there any turn-around in 2.7? I thought I can use gravatar but I was wrong, because you can use gravatar only in a LOOP and If I do so then I’ll have an avatar for every post of the author. I only need one photo before the author name at the top of the page. Here is my author page code:

    <?php get_header(); ?>
    <?php
    global $wp_query;
    $curauth = $wp_query->get_queried_object();
    ?>

    <!–content–>
    <div id=”content”>

    <!–left-col–>
    <div id=”left-col”>

    <h2><?php echo $curauth->nickname; ?></h2>

    <p><?php echo $curauth->description; ?></p>

    <p>Website: user_url ?>” target=”_blank”><?php echo $curauth->user_url ?>
    </p>

    <!– Authors –>
    <div class=”authors”>
    <h2 class=”pdaauthors”>Posts by <?php echo $curauth->first_name ?>: (<?php the_author_posts(); ?>)</h2>
    <?php query_posts($query_string.’&posts_per_page=-1′);
    if (have_posts()) :
    echo “

    \n”;
    else: ?>
    <p>< ?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php endif; ?>
    </div>
    <!–Authors end–>

    </div>

    <?php get_sidebar(); ?>
    </div>
    <!–content-end–>

    </div>
    <!–wrapper-end–>

    <?php get_footer(); ?>

  • The topic ‘How to display author image in author.php?’ is closed to new replies.
Skip to toolbar