[resolved] List authors with avatar pic and last posts? (6 posts)

  1. hungzai
    Posted 5 years ago #

    Is it possible to list the authors of a website, with avatar pic and also last posts of the author?

    What I'm doing now is manually list all the authors which is slightly inconvenient since when there are new authors, I have to add on to the list manually.

    Just wondering could it be done with just a piece of code?

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 5 years ago #

    Yeah....you could make a page template and have the list of authors automaticcally generated. This could possibly get you started in the right direction

  3. MichaelH
    Posted 5 years ago #

    //displays all users with their avatar and their posts (titles)
    $blogusers = get_users_of_blog();
    if ($blogusers) {
      foreach ($blogusers as $bloguser) {
        $user = get_userdata($bloguser->user_id);
        echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . '</p>';
        echo get_avatar( $user->ID, 46 );
          'author' => $user->ID,
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
            <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
      wp_reset_query();  // Restore global post data stomped by the_post().
  4. hungzai
    Posted 5 years ago #

    Thanks guys. It worked like a charm!!!!!

  5. Gabriel
    Posted 4 years ago #

    Thanks! This saved my day!

  6. WP Gurus
    Posted 4 years ago #

    I want to show just the authors of my blog. This code is displaying the contributors as well. Is that possible?

Topic Closed

This topic has been closed to new replies.

About this Topic