Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. function contributors() {
  2. global $wpdb;
  3. $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name"); //Go get all users
  4.  
  5. $current_category = get_query_var('cat');
  6. // to then get the cat name
  7. $current_category_name = get_cat_name( $current_category);
  8.  
  9. foreach($authors as $author) {
  10.  
  11. $fileira = get_the_author_meta('fileira', $author->ID); //get the value of fileira custom field
  12.  
  13. if(strtolower($fileira) == strtolower($current_category_name)) {
  14. //if the fileira custom field value is the same as category name
  15. //the users with current category ID/name on fileira custom field should appear
  16.  
  17. echo "<li>"."<a href=\"".get_bloginfo('url')."/?author=".$author->ID."\">".get_avatar($author->ID)."</a>";
  18. echo '<div>'."<a href=\"".get_bloginfo('url')."/?author=".$author->ID."\">".the_author_meta('display_name', $author->ID)."</a>"."</div>"."</li>";
  19. echo '<div>'.$fileira."</div>"."</li>"; //show fileira value
  20. }
  21.  
  22. }
  23. }
  24.  
  25. contributors();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement