• I want to list authors with last post title and order them by last post date. Now i have this codes but i don`t know how to edit them.

    <?php
    //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 );
      $args=array(
      '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>
        <?php
      endwhile;
    }
      wp_reset_query();  // Restore global post data stomped by the_post().
    }
    }
    ?>

    I think that alternative way is – list last posts and avoid author duplicating. Please help.

Viewing 1 replies (of 1 total)
  • i tried it, it didn’t duplicate any author listings, just shows each author avatar, id and name, all authors posts listsed below, with last post at the top of the list.

    If you wanted to just show each author with their latest post title, most recent posting author first, just change

    'posts_per_page' => -1,

    to

    'posts_per_page' => 1,

Viewing 1 replies (of 1 total)
  • The topic ‘List authors and order by last post date.’ is closed to new replies.