开发者

List authors with gravatar and other data in wordpress?

How do I list authors with their gravatar, first namne last name and nicknam开发者_如何学运维e in wordpress?


This is how I did it!

            <?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>";
                }
              }
            }

?>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜