如何使用他们的gravatar列出作者,在wordpress中列出姓名和昵称?
答案 0 :(得分:2)
这就是我做到的!
<?php
// Displays user name and email from users with at least one post
$blogusers = get_users_of_blog();
if ($blogusers) {
foreach ($blogusers as $bloguser) {
$args = array(
'author' => $bloguser->user_id,
'showposts' => 1,
'caller_get_posts' => 1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$user = get_userdata($bloguser->user_id);
echo "<img src='http://www.gravatar.com/avatar/" . md5( strtolower( trim( " $user->user_email " ) ) )."?s=125' /><li>".$user->user_firstname."</li><li>".$user->user_lastname."</li>";
}
}
}
&GT;