[wordpress插件] Avatar – User Photo Shortcode头像-用户照片简码

wordpress 插件 文章 2020-02-26 04:10 491 0 全屏看文

AI助手支持GPT4.0

评分
60
描述

This plugin adds the avatar shortcode.

此插件添加头像简码。

It lets you show any user photo on your site.

它使您可以显示网站上的任何用户照片。

Simply place the [get_avatar] shortcode in you post content.

只需在您发布的内容中放置[get_avatar]简码。

While you can do this in templates many times you might want to show an avatar without writing PHP.

尽管您可以在模板中多次执行此操作,但是您可能想显示一个化身而不编写PHP。

This plugin adds the same paramaters that the get_avatar function does.

该插件添加了与get_avatar函数相同的参数。

As a developer you might use this in your template:

作为开发人员,您可以在模板中使用它:

  <?php echo get_avatar('email@example.com',64,'http://www.example.com/custom-default-avatar.png','Image Alt Text'); 

?>

?>

The above would get you this for logged in users:

上面为登录的用户提供的信息如下:

  “”

With this shortcode you can do the same thing in your content:
    

使用此短代码,您可以在内容中执行相同的操作:
    

[get_avatar id=”email@example.com” size=”64″ default=”http://www.example.com/custom-default-avatar.png” alt”Image Alt Text”]

[get_avatar id =” email@example.com” size =” 64” default =” http://www.example.com/custom-default-avatar.png” alt“图片替换文字”]

The shortcode would return almost the exact same thing with some additionals:

简码会返回几乎完全相同的东西,并带有一些附加内容:

Image Alt Text

64张照片“ height =” 64“ width =” 64“>

I added a span tag around the image to allow for additional styling.

我在图像周围添加了一个span标签,以允许其他样式。

Just add the style or class attributes to the shortcode to customize it’s look.

只需在简码中添加样式或类属性即可自定义外观。

[get_avatar class="circle"]

  [get_avatar class =“ circle”]

Currently I added the rounded and circle styles which you can use.

当前,我添加了可以使用的圆形和圆形样式。

Circle will make the image a complete circle similar to how gmail shows your picture in the top right corner.

圆将使图像变成一个完整的圆,类似于gmail在右上角显示图片的方式。

[get_avatar style="border: 2px solid #000000"]

  [get_avatar style =“ border:2px solid#000000”]

While you can include any of your classes using the class attribute you can also include styles inline using the method above.

尽管您可以使用class属性包含任何类,但也可以使用上述方法内联包含样式。

This will get added directly inline in the span tag.

这将直接直接内联在span标签中添加。

While this is good for general styling like borders, to add css directly to the image itself use either your own class or the get_avatar class and add any additional styling to your themes stylesheet.

尽管这对于边框之类的常规样式很有用,但是要使用图像直接将css直接添加到图像本身,请使用您自己的类或get_avatar类,然后将其他样式添加到主题样式表中。

This method gives you the most customization although it requires you to add css.

尽管需要添加css,该方法仍可为您提供最多的自定义功能。

Using get_avatar in your stylesheet:

在样式表中使用get_avatar:

.get_avatar img {

  .get_avatar img {

}

}

Or you could add several different styles depending on the pages of your site.

或者您可以根据站点的页面添加几种不同的样式。

For example I could add this to my stylesheet to style to style different avatars:

例如,我可以将其添加到样式表中以设置样式以设置不同的头像:

.get_avatar homepage img {

  .get_avatar主页img {

}

}

.get_avatar profilepage img {

.get_avatar个人资料页img {

}

}

.get_avatar author john_smith img {

.get_avatar作者john_smith img {

}

}

Then my shortcodes would look like this :

然后我的简码应如下所示:

[get_avatar class="homepage"]

  [get_avatar class =“ homepage”]

[get_avatar class="profilepage"]

[get_avatar class =“ profilepage”]

[get_avatar class="author john_smith"]

[get_avatar class =“ author john_smith”]

Thats pretty much it.

就可以了。

See https://codex.wordpress.org/Function_Reference/get_avatar for the default template function usage.

有关默认模板功能的用法,请参见https://codex.wordpress.org/Function_Reference/get_avatar。

Questions or requests let me know.

问题或要求让我知道。

安装步骤

This section describes how to install the plugin and get it working.

本节介绍如何安装插件并使其正常工作。

    1. Upload plugin-name.php to the /wp-content/plugins/ directory
    2. plugin-name.php 上载到 / wp-content / plugins / 目录

    3. Activate the plugin through the ‘Plugins’ menu in WordPress
    4. 通过WordPress中的“插件”菜单激活插件

    5. Add the [get_avatar] shortcode in your content.
    6. 在您的内容中添加 [get_avatar] 简码。

下载地址
https://downloads.wordpress.org/plugin/avatar-shortcode.zip
-EOF-

AI助手支持GPT4.0