Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2012
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. function contributors() {
  2. $authors = array();
  3. // roles you want to include
  4. $roles = array('administrator', 'editor','author','contributor');
  5.  
  6. foreach ($roles as $role) {
  7. $users_query = get_users(
  8. array(
  9. 'fields' => array('ID', 'user_nicename'),
  10. 'role' => $role
  11. )
  12. );
  13. if($users_query) {
  14. $authors = array_merge($authors, $users_query);
  15. }
  16. }
  17.  
  18. if(!empty($authors)) {
  19.  
  20. foreach($authors as $author) {
  21.  
  22. echo '<div class="authWrap">';
  23. echo '<div class="authPic">';
  24. echo "<a href=\"".get_bloginfo('url')."/?author=";
  25. echo $author->ID;
  26. echo "\">";
  27. echo get_avatar($author->ID,$size = '50');
  28. echo "";
  29. echo "</div>";
  30. echo '<div class="authName">';
  31. echo "<a href=\"".get_bloginfo('url')."/?author=";
  32. echo $author->ID;
  33. echo "\">";
  34. the_author_meta('display_name', $author->ID);
  35. echo "</a>";
  36. echo "</div>";
  37. echo "</div>";
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement