Author list in sidebar
-
I’ve been trying to show an author list on my sidebar with an avatar and the author’s latest posts. Its basically working but I want to restrict the list to just the users set as contributors and nothing else. Right now it shows all users in the blog. Any help would be greatly appreciated. Thanks.
<div class="author"> <?php //get all users, iterate through users, query for one post for the user, //if there is a post then display the post title, author, content info $blogusers = get_users_of_blog(); if ($blogusers) { foreach ($blogusers as $bloguser) { $args = array( 'author' => $bloguser->user_id, 'showposts' => 1, 'caller_get_posts' => 1, ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div style="border-top:1px solid #bababa; margin:0"> <?php echo get_avatar( get_the_author_email(), '80' ); ?> <h4 style="padding-top:10px;"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br /><small><?php the_author_posts_link(); ?> </small></h4> <?php the_excerpt(); ?> <p class="more-link"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" style="color: rgb(157, 20, 20); font-weight: bold;"><?php _e('Read', 'news'); ?></a> | Comments (<?php comments_number('', '1', '%'); ?>)</p> </div> <? endwhile; } } } ?> </div> <div style="clear:both;"></div>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Author list in sidebar’ is closed to new replies.