function get_the_avatars_with_link_to_authors(){ $authors = get_users_of_blog(); foreach ($authors as $author){ $author_data = get_userdata($author->user_id); $author_nicename = $author_data->user_nicename; $author_displayname = $author_data->display_name; $link .= '<li style=\"list-style-type:none;list-style-position: outside\"><a style=\"text-decoration:none;\" href=\"' . get_author_posts_url($author_data->ID) . '\" title=\"' . sprintf( __( \"View %s's profile\" ), $author_displayname ) . '\">' . get_avatar($author_data->ID,$size = '35') . $author_displayname . '</a></li>'; } return $link;}
<?php printf( __( '%s', 'libra' ), get_the_avatars_with_link_to_authors() ) ?>
function get_the_avatars_with_link_to_authors(){ $authors = get_users_of_blog(); foreach ($authors as $author){ $author_data = get_userdata($author->user_id); $author_nicename = $author_data->user_nicename; $author_displayname = $author_data->display_name; if( ! $author_data->user_level === 10 ){ $link .= '<li style=\"list-style-type:none;list-style-position: outside\"><a style=\"text-decoration:none;\" href=\"' . get_author_posts_url($author_data->ID) . '\" title=\"' . sprintf( __( \"View %s's profile\" ), $author_displayname ) . '\">' . get_avatar($author_data->ID,$size = '35') . $author_displayname . '</a></li>';} } return $link;}
First post on here so here goes...
I have a list of gravatars in my sidebar that display all the authors as well as a text link (see image below - admin highlighted with a red outline). I want to hide the admin's gravatar and link from appearing there and not sure how to do this.
http://i61.photobucket.com/albums/h70/magicdaps10/gravatars.jpg
Really stuck on this one as I am pretty new to php so here is my code:
I have this in my functions.php file:
function get_the_avatars_with_link_to_authors(){$authors = get_users_of_blog();
foreach ($authors as $author){
$author_data = get_userdata($author->user_id);
$author_nicename = $author_data->user_nicename;
$author_displayname = $author_data->display_name;
$link .= '<li style=\"list-style-type:none;list-style-position: outside\"><a style=\"text-decoration:none;\" href=\"' . get_author_posts_url($author_data->ID) . '\" title=\"' . sprintf( __( \"View %s's profile\" ), $author_displayname ) . '\">' . get_avatar($author_data->ID,$size = '35') . $author_displayname . '</a></li>';
}
return $link;
}
and in my sidebar.php file i have:
Somehow (and I don't know how) I think I need to alter or add something to my function.php file?
Thanks in advance if anyone can help me out on this one. ;)
function get_the_avatars_with_link_to_authors(){$authors = get_users_of_blog();
foreach ($authors as $author){
$author_data = get_userdata($author->user_id);
$author_nicename = $author_data->user_nicename;
$author_displayname = $author_data->display_name;
if( ! $author_data->user_level === 10 ){
$link .= '<li style=\"list-style-type:none;list-style-position: outside\"><a style=\"text-decoration:none;\" href=\"' . get_author_posts_url($author_data->ID) . '\" title=\"' . sprintf( __( \"View %s's profile\" ), $author_displayname ) . '\">' . get_avatar($author_data->ID,$size = '35') . $author_displayname . '</a></li>';
}
}
return $link;
}
Thanks ;)