Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2.  
  3. $args = array(
  4. 'role' => 'Author',
  5. 'meta_key' => 'order-number',
  6. 'orderby' => 'order-number',
  7. 'order' => 'asc',
  8. );
  9.  
  10. $wp_user_query = new WP_User_Query($args);
  11. $authors = $wp_user_query->get_results();
  12.  
  13. if (!empty($authors))
  14. {
  15. echo '<div style="float:left;">';
  16. foreach ($authors as $author)
  17. {
  18. $author_info = get_userdata($author->ID);
  19. echo '<div class="post team-member"><div class="image">';
  20. echo get_avatar( $author_info->ID, 91 );
  21. echo '</div>';
  22. echo '<div class="content"><div class="title"><a href="/author/' . $author_info->user_login . '">' . $author_info->user_firstname . ' ' . $author_info->user_lastname . '</a></div>';
  23. echo '' . substr( get_the_author_meta('user_description',$author_info->ID) , 0 , 100 ) . '...';
  24. echo '</div></div>';
  25. }
  26. echo '</div>';
  27. } else {
  28. echo 'No authors found';
  29. }
  30.  
  31. ?>
  32.  
  33. <?php
  34. global $wpdb; //Ignore this line if you're not within a function
  35. $order = $wpdb->get_results("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='order-number' ORDER BY meta_value ASC", "ARRAY_N");
  36. $authors = array();
  37. foreach($order as $aid)
  38. $authors[] = new WP_User($aid[0]);
  39.  
  40. if (!empty($authors))
  41. {
  42. echo '<div style="float:left;">';
  43. foreach ($authors as $author)
  44. {
  45. $author_info = get_userdata($author->ID);
  46. echo '<div class="post team-member"><div class="image">';
  47. echo get_avatar( $author_info->ID, 91 );
  48. echo '</div>';
  49. echo '<div class="content"><div class="title"><a href="/author/' . $author_info->user_login . '">' . $author_info->user_firstname . ' ' . $author_info->user_lastname . '</a></div>';
  50. echo '' . substr( get_the_author_meta('user_description',$author_info->ID) , 0 , 100 ) . '...';
  51. echo '</div></div>';
  52. }
  53. echo '</div>';
  54. } else {
  55. echo 'No authors found';
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement