Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function contributors() {
- global $wpdb;
- $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users ORDER BY display_name"); //Go get all users
- $current_category = get_query_var('cat');
- // to then get the cat name
- $current_category_name = get_cat_name( $current_category);
- foreach($authors as $author) {
- $fileira = get_the_author_meta('fileira', $author->ID); //get the value of fileira custom field
- if(strtolower($fileira) == strtolower($current_category_name)) {
- //if the fileira custom field value is the same as category name
- //the users with current category ID/name on fileira custom field should appear
- echo "<li>"."<a href=\"".get_bloginfo('url')."/?author=".$author->ID."\">".get_avatar($author->ID)."</a>";
- echo '<div>'."<a href=\"".get_bloginfo('url')."/?author=".$author->ID."\">".the_author_meta('display_name', $author->ID)."</a>"."</div>"."</li>";
- echo '<div>'.$fileira."</div>"."</li>"; //show fileira value
- }
- }
- }
- contributors();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement