我在网上找到了这个代码。这非常有用,但我需要在用户附近显示用户评论计数。名称。 我该怎么办?
$allUsers = get_users('orderby=comment_count&order=DESC');
$users = array();
// Remove subscribers from the list as they won't write any articles
foreach($allUsers as $currentUser)
{
if(!in_array( 'administrator', $currentUser->roles ))
{
$users[] = $currentUser;
}
}
foreach($users as $user)
{
<a href="<?php echo get_author_posts_url( $user->ID ); ?>"><?php echo $user->display_name; ?>
<?php echo get_avatar( $user->user_email, '128' ); ?>
}