如何在WordPress中显示带有照片的作者列表

If you’re running a multi-author WordPress blog, and you want to highlight your authors by displaying a list of authors with their photos, then you’re in the right place. Previously we showed you how to display an authors list in WordPress, but this method is very code intensive. Then we showed you how to create a simple staff list in WordPress, but that requires you to recreate author profiles in a separate section. In this article, we will cover how to show an authors list with photos in WordPress without writing a single line of code.

如果您正在运行一个多作者WordPress博客,并且想要通过显示带有照片的作者列表来突出显示作者,那么您来对地方了。 之前,我们向您展示了如何在WordPress中显示作者列表 ,但是这种方法需要大量代码。 然后,我们向您展示了如何在WordPress中创建简单的人员列表 ,但这需要您在单独的部分中重新创建作者个人资料。 在本文中,我们将介绍如何在WordPress中显示照片的作者列表,而无需编写任何代码。

影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

First thing you need to do is install and activate Author Avatars plugin. After activating the plugin, you get a widget and two shortcodes that you can use to display authors list with their photos.

您需要做的第一件事是安装并激活Author Avatars插件。 激活插件后,您将获得一个小部件和两个短代码,可用于显示作者列表及其照片。

使用小部件显示带有照片的作者列表 (Display Authors List with Photos Using a Widget)

If you want to display the authors list in your sidebar or another widget area, then you need to use the widget method. Go to Appearance » Widgets and drag-drop the AuthorAvatars widget to your sidebar. This widget comes with various options that allows you to customize your list in the way you want.

如果要在侧边栏或其他窗口小部件区域中显示作者列表,则需要使用窗口小部件方法。 转到外观»小部件,然后将AuthorAvatars小部件拖放到侧边栏中。 该小部件带有各种选项,可让您以所需的方式自定义列表。

Adding author avatar widget

From the widget’s configuration screen, you can set the image size for author’s avatar, choose which author information to display, set a minimum number of posts required, choose user roles, and more.

在小部件的配置屏幕上,您可以设置作者头像的图像大小,选择要显示的作者信息,设置所需的最少帖子数,选择用户角色等等。

使用简码显示带有照片的作者列表 (Display Authors List with Photos using Shortcode)

The plugin comes with two shortcodes. To add an authors list with photos inside a post or page, you can use the shortcode [authoravatars]. However, simply adding the shortcode alone will only display the avatars of authors. This shortcode has other parameters that you can add to display additional information. For example:

该插件带有两个简码。 要在帖子或页面中添加带有照片的作者列表,可以使用简码[authoravatars] 。 但是,仅添加简码将仅显示作者的化身。 该简码还有其他参数,您可以添加这些参数以显示其他信息。 例如:

[authoravatars avatar_size=44 link_to_authorpage=true show_name=true show_biography=true]

[authoravatars avatar_size=44 link_to_authorpage=true show_name=true show_biography=true]

You can also modify the appearance of your list by overriding the styles in your theme’s style.css file. We added this CSS to our demo to customize the display:

您还可以通过覆盖主题的style.css文件中的样式来修改列表的外观。 我们将此CSS添加到了演示中以自定义显示:


.shortcode-author-avatars .avatar { 
float:left;
text-align:left;
padding:3px;
margin:3px;
border: 1px solid #EEE;
}
.shortcode-author-avatars div.author-list .user {
text-align: left;
}

This is how the author’s list looked after applying the custom CSS above:

这是应用上述自定义CSS之后的作者列表的样子:

Authors list with Photos in WordPress
在WordPress中显示带照片的未注册作者 (Display Unregistered Author with Photo in WordPress)

This plugin also allows you to display unregistered users by using their email address. This is particularly useful for guest authors who may not have a user account on your site. You can also use this method to highlight any user of your site by using their user id or email address. The shortcode to display single user avatar is [show_avatar]. It also has parameters which can be used like this:

该插件还允许您通过使用未注册用户的电子邮件地址来显示他们。 这对于可能在您的站点上没有用户帐户的来宾作者特别有用。 您还可以使用此方法通过使用其用户ID或电子邮件地址突出显示您网站的任何用户。 显示单个用户头像的简码是[show_avatar] 。 它还具有可以像这样使用的参数:

[show_avatar email=mail@address.com avatar_size=25 align=left]

[show_avatar email=mail@address.com avatar_size=25 align=left]

You can also modify the appearance of avatar by overriding plugin’s stylesheet in your theme’s style.css file.

您还可以通过覆盖主题的style.css文件中的插件样式表来修改头像的外观。


.shortcode-show-avatar {
  padding: 3px;
  border: 2px solid #EEE;
}

允许作者在WordPress中上传个人资料照片 (Allow Authors to Upload Profile Photo in WordPress)

By default this plugin uses gravatar, but in some cases your authors may not want to display their gravatar. In that case, you can allow them to upload their own profile photo in WordPress.

默认情况下,此插件使用gravatar ,但是在某些情况下,您的作者可能不希望显示其gravatar。 在这种情况下,您可以允许他们在WordPress中上传自己的个人资料照片。

First thing you need to do is install and activate Simple Local Avatars plugin. Upon activation the plugin adds an Avatar upload section on user profile page. Users can go to Users » Your Profile page to upload their own photo to be used as avatar on your site.

您需要做的第一件事是安装并激活Simple Local Avatars插件。 激活后,插件会在用户个人资料页面上添加头像上传部分。 用户可以转到“ 用户»您的个人资料”页面上传自己的照片,以用作您网站上的头像。

Adding user profile photo as local avatar in WordPress

If the author has a custom avatar, then author avatars will simply display the custom image rather than showing the gravatar.

如果作者具有自定义头像,则作者头像将仅显示自定义图像,而不显示图形头像。

We hope that this article helped you add an authors list with photos on your WordPress site. If you have any questions and feedback, then please leave a comment below. Also don’t forget to follow us on Twitter.

我们希望本文能帮助您在WordPress网站上添加带有照片的作者列表。 如果您有任何问题和反馈,请在下面发表评论。 也不要忘记在Twitter上关注我们。

翻译自: https://www.wpbeginner.com/plugins/show-authors-list-photos-wordpress/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值