wordpress头像被墙_如何在WordPress注释中显示Twitter头像

wordpress头像被墙

As you know that WordPress has an option to display gravatars in the comment for your users. Well sometimes users don’t have a gravatar account, but they have a twitter account. In this article we will share a way for you to combine gravatar and twitter avatars to display in your comment area.

如您所知,WordPress可以选择在注释中为用户显示凹版。 有时候用户没有Gravatar帐户,但他们有Twitter帐户。 在本文中,我们将为您提供一种将gravatar和twitter头像组合在一起以显示在您的评论区域中的方法。

Twitter Avatars in WordPress Comments
这个插件做什么? (What does this plugin do?)
  • Loads user’s avatar by matching the email address to the user’s Twitter email address.

    通过将电子邮件地址与用户的Twitter电子邮件地址进行匹配来加载用户的头像。
  • If user doesn’t have a Twitter account, it first tries to load user’s gravatar. If user doesn’t have a gravatar, it loads a default image. This is an optional setting.

    如果用户没有Twitter帐户,则它将首先尝试加载用户的图像。 如果用户没有图像,它将加载默认图像。 这是一个可选设置。
  • You can set a 2-pixel border to the images (you choose the color).

    您可以为图像设置2像素的边框(选择颜色)。
  • You can choose the sizes: Preferred ones are 24, 48 or 72 pixels.

    您可以选择大小:首选为24、48或72像素。
  • You can set an image other than the default one to load if a user doesn’t have a Twitter account or a gravatar.

    如果用户没有Twitter帐户或图像,则可以设置默认图像以外的其他图像来加载。
  • It builds a valid image for you (with alt and title attributes, etc.) based on user details.

    它根据用户详细信息为您构建有效的图像(具有alt和title属性等)。
  • Allows you to add a class to the image, so you can style it later.

    允许您向图像添加一个类,以便稍后进行样式设置。
安装指南 (Installation Guide)

First download and activate the plugin. Then you would need to place this code in your comment(s).php where you want to display the avatar.

首先下载并激活插件。 然后,您需要将此代码放置在要显示化身的地方comment.s.php中。

<?php twittar(size, placeholderimg, border, class, usegravatar, rating); ?>

<?php twittar(大小,占位符img,边框,类,usegravatar,等级); ?>

Now you would need to change the parameter in the code using the guide below:

现在,您需要使用以下指南在代码中更改参数:

size
The size of the avatar (in pixels). Just insert the number (e.g. 45), without “px.” It is the size for both width and height.

尺寸
化身的大小(以像素为单位)。 只需插入数字(例如45),不带“ px”。 它是宽度和高度的大小。

placeholderimg
The URL for the image you want to use when the user has neither a Twitter account nor a gravatar. Must be inside quotes (””). Optional.

占位符img
用户既没有Twitter帐户又没有Gravatar时要使用的图像的URL。 必须在引号(“”)之内。 可选的。

border

边境

The color for the 2px border. Insert the hexadecimal code of the color (e.g. “#FFFFFF” with the “” marks) but only if you want to use one.

2px边框的颜色。 插入颜色的十六进制代码(例如,带有“”标记的“ #FFFFFF”),但仅在您要使用一个时才插入。

class
A CSS class that you want to use to style the avatar. For example: “myimg.” In the CSS, you would include .myimg { }. Put inside “”.


您要用来为化身设置样式CSS类。 例如:“ myimg”。 在CSS中,应包含.myimg {}。 放进去 ””。

usegravatar
Just insert 1 if you want to use gravatars, and 0 if you don’t. If you choose to use gravatars, it will try to load a gravatar image if a Twitter account and picture is not found, otherwise it will load the placeholderimg (default) image directly.

使用凹版
如果要使用凹版印刷机,则只需插入1;否则,请输入0。 如果选择使用凹版印刷机,则如果未找到Twitter帐户和图片,它将尝试加载Gravatar图像,否则将直接加载placeholderimg(默认)图像。

rating
Parameter for gravatars only. Read more at www.gravatar.com.

评分
仅凹版印刷机的参数。 请访问www.gravatar.com了解更多信息

Note: if you want to skip a parameter and add another in front of it, just replace it with “”.

注意:如果要跳过参数并在其前面添加另一个,只需将其替换为“”即可。

For Example:

例如:

<?php twittar("45", "", "", "myimg", 1, "R"); ?>

<?php twittar(“ 45”,“”,“”,“ myimg”,1,“ R”); ?>

License: The plug-in is released under the GPL. You can use it for all your projects for free and without any restrictions. You may modify the plug-in as you wish.

许可证:该插件是根据GPL发布的。 您可以免费且无任何限制地将其用于所有项目。 您可以根据需要修改插件。

下载插件 (Download the Plugin)

Source: Smashing Magazine

资料来源:《 粉碎杂志》

翻译自: https://www.wpbeginner.com/plugins/how-to-display-twitter-avatars-in-wordpress-comments/

wordpress头像被墙

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值