In @Sagive SEO answer get_users_of_blog() is a depricated function.
What is below code do
- get all authors
display name
andid
in$authorsList
-
Loop threw each author id and use
WP_Query
to get latest post of each author<?php $authors=get_users(); $i=0; //get all users list foreach($authors as $author){ $authorList[$i]['id']=$author->data->ID; $authorList[$i]['name']=$author->data->display_name; $i++; } ?> <ul> <?php foreach($authorList as $author){ $args=array( 'showposts'=>1, 'author'=>$author['id'], 'caller_get_posts'=>1 ); $query = new WP_Query($args); if($query->have_posts() ) { while ($query->have_posts()){ $query->the_post(); ?> <li> <h2><?php echo $author['name']; ?></h2> <a href="https://wordpress.stackexchange.com/questions/63060/<?php echo get_permalink(); ?>"> <?php echo get_the_title(); ?> </a> </li> <?php } wp_reset_postdata(); } } ?> </ul>
Important Link: