Advertising
Paste Description for WordPress display top 10 authors
http://wordpress.org/support/topic/323053
- WordPress display top 10 authors
- Tuesday, October 20th, 2009 at 1:03:52pm MDT
- <?php
- //Get users and count of posts put into array $uc, sort array by post count ascending, loop through array and echo user info, get latest post for each user and display time and title
- $blogusers = get_users_of_blog();
- if ($blogusers) {
- foreach ($blogusers as $bloguser) {
- $post_count = get_usernumposts($bloguser->user_id);
- $uc[$bloguser->user_id]=$post_count;
- }
- $maxauthor=2;
- $count=0;
- foreach ($uc as $key => $value) {
- $count++;
- if ($count <= $maxauthor) {
- $user = get_userdata($key);
- $author_posts_url = get_author_posts_url($key);
- $post_count = $value;
- echo 'User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . ' number of posts: ' . $post_count . ' author posts url: ' . $author_posts_url .'';
- 'showposts'=>1,
- 'author'=>$user->ID,
- 'caller_get_posts'=>1
- );
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) {
- while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
- <?php
- endwhile;
- }
- }
- }
- }
- ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.