[wordpress插件] Author Image(s)作者图像

wordpress 插件 文章 2020-02-23 15:50 523 0 全屏看文

AI助手支持GPT4.0

评分
0
描述

Display image (if present) and/or name for the author of a post, or for all authors on the blog.

显示帖子作者或博客上所有作者的图像(如果有)和/或名称。

Use

使用 <?php c2c_the_author_image();

?> as a replacement for or

?> 替代 <?php the_author()?> <?php get_avatar();

?> in index.php (and/or any other post templates) to display an image for a post’s author (inside “the loop”)

?> 在index.php(和/或任何其他帖子模板)中显示帖子作者的图片(在“循环”中)

Use

使用 <?php c2c_wp_list_authors_images();

?> as a replacement for

?> 代替 <?php wp_list_authors();

?> in the sidebar section of your site to list all authors for the blog using an image and/or text.

网站侧边栏部分的?> ,以使用图像和/或文本列出博客的所有作者。

The plugin also provides a simple widget for listing authors.

该插件还提供了一个用于列出作者的简单小部件。

Process by which the image is located and/or text used:

定位图像和/或使用文字的过程:

    1. If a post has an ‘author_image’ custom field defined, the plugin checks if the value is the valid name of an image in the defined image directory.

    2. 如果帖子中定义了“ author_image”自定义字段,则插件会检查该值是否为已定义图像目录中图像的有效名称。

      If not, it appends each of the defined image extensions, in turn, to the custom field’s value, then checks if an image can be found.

    3. 如果没有,它将依次将每个定义的图像扩展名附加到自定义字段的值,然后检查是否可以找到图像。

    4. If no image has been found yet, it looks in the image directory for a file with a name that is the author’s login name with a file extension matching one of the ones defined in image extensions.
    5. 如果尚未找到图像,它将在图像目录中查找名称为作者登录名且文件扩展名与图像扩展名定义的文件名匹配的文件。

    6. If no image has been found yet, it looks in the image directory for a file with a name that is the author’s ID with a file extension matching one of the ones defined in image extensions.
    7. 如果尚未找到图像,它将在图像目录中查找名称为作者ID且文件扩展名与图像扩展名中定义的文件之一匹配的文件。

    8. If no image has been found yet and Gravatar support is enabled, it then asks Gravatar for the avatar associated with the author (based on author’s email address).
    9. 如果尚未找到图片并且启用了Gravatar支持,则会向Gravatar询问与作者关联的头像(基于作者的电子邮件地址)。

    10. If no image has been found yet and a blank/generic image has been defined, then the blank image is used as the author’s avatar.
    11. 如果尚未找到图片并且定义了空白/通用图片,则将空白图片用作作者的头像。

    12. If an image has been found and the “Show author name as well?”

    13. 如果找到了图像,并且“还显示作者姓名?”

      setting is true, or if no author image has been found and “Show author name if image is found?”

      设置为true,或者找不到作者图像,并且显示“如果找到图像则显示作者名称?”

      setting is true, then the author’s name is appended/used.

    14. 设置为true,然后会附加/使用作者的姓名。

    Additional notes:

    其他说明:

      • The plugins admin options page allows you to control if the author's name should appear alongside the author image or not, if the author name should be shown in the event no author image could be found, the image directory, the support image extensions

      • 通过插件管理选项页面,您可以控制是否应在作者图像旁边显示作者姓名,如果在找不到作者图像的情况下应显示作者姓名,图像目录,支持图像扩展名

        , and if and what you want the author image to link to.

      • ,以及您希望作者图像链接到的内容和内容。

      • Images output by c2c_the_author_image() are defined with class=”author_image” for stylesheet manipulation
      • c2c_the_author_image()输出的图像使用class =“ author_image”定义,用于样式表操作

      • Images output by c2c_wp_list_authors_images() are defined with class=”list_author_image” for stylesheet manipulation
      • c2c_wp_list_authors_images()输出的图像使用class =“ list_author_image”进行定义以用于样式表操作

      Tip:: You can take advantage of the $image_dir argument to display different author images under different contexts, ie locate your images in different directories 'wp-content/images/authors/small/' and 'wp-content/images

      提示::您可以利用$ image_dir参数在不同的上下文中显示不同的作者图像,即,将图像放置在“ wp-content / images / authors / small /”和“ wp-content / images”的不同目录中

      /authors/large/' and decide on context where to get the image(s) from.

      / authors / large /',并确定从何处获取图像的上下文。

      Links: Plugin Homepage |

      链接:插件主页 |

      Plugin Directory Page |

      插件目录页面 |

      Author Homepage

      作者主页

      Template Tags

      模板标签

      The plugin provides three optional template tags for use in your theme templates.

      该插件提供了三个可选模板标签,供您在主题模板中使用。

      Functions

      功能

        • function c2c_get_author_image( $args = array() )

          函数c2c_get_author_image($ args = array())

          Gets the image and/or name for an author.

          获取作者的图像和/或名称。

        • function c2c_the_author_image( $before = '', $after = '', $image_dir = '', $width = '', $height = '' )

          函数c2c_the_author_image($ before =``,$ after ='',$ image_dir =``,$ width ='',$ height =``))

          A drop-in replacement for WordPress’s the_author() , allowing the author for the post to have an image displayed in lieu of the name (if an image can be found).

          WordPress的 the_author()的直接替代品,允许帖子的作者显示图像来代替名称(如果可以找到图像)。

        • function c2c_wp_list_authors_images( $args = '' )

          函数c2c_wp_list_authors_images($ args ='')

          A drop-in replacement for WordPress’s wp_list_authors(), allowing all authors for a blog to be listed with an image (if present).

          WordPress的 wp_list_authors()的直接替代品,可以为博客的所有作者列出图片(如果有)。

        This displays the image associated with a post’s categories.

        这将显示与帖子类别相关的图像。

        Arguments

        参数

          • $before

            $ before

            Optional argument.

            可选参数。

            The text and/or HTML to appear before the author image/text, if any such text would be returned.

            如果将返回任何这样的文本,则显示在作者图像/文本之前的文本和/或HTML。

          • $after

            $ after

            Optional argument.

            可选参数。

            The text and/or HTML to appear after the author image/text, if any such text would be returned.

            该文本和/或HTML(如果返回任何此类文本,则显示在作者图像/文本之后)。

          • $image_dir

            $ image_dir

            Optional argument.

            可选参数。

            The directory, relative to the root of your blog, in which to find the author images.

            相对于博客根目录的目录,可在其中找到作者图像。

            If not set, it defaults to the value configured via the plugin’s admin options page.

            如果未设置,则默认为通过插件的管理选项页配置的值。

          • $width

            $ width

            Optional argument.

            可选参数。

            The forced width of the image (will cause browser to resize if image is of different width).

            图片的强制宽度(如果图片的宽度不同,将导致浏览器调整大小)。

            Leave blank to retain image’s original width (or for the width to be scaled in proportion to a specified height).

            留空以保留图像的原始宽度(或将宽度与指定高度成比例地缩放)。

            It is recommended that images exist at the desired size.

            建议图像以所需大小存在。

          • $height

            $ height

            Optional argument.

            可选参数。

            The forced height of the image (will cause browser to resize if image is of different height).

            图片的强制高度(如果图片的高度不同,将导致浏览器调整大小)。

            Leave blank to retain image’s original height (or for the height to be scaled in proportion to a specified width).

            保留空白以保留图像的原始高度(或将高度与指定宽度成比例缩放)。

            It is recommended that images exist at the desired size.

            建议图像以所需大小存在。

          • $author_id

            $ author_id

            Optional argument.

            可选参数。

            The id of the author.

            作者的ID。

            If null, then gets the author for the current post.

            如果为null,则获取当前帖子的作者。

            Default is null.

            默认为空。

          • $args (as used in c2c_get_author_image())

            $ args (在 c2c_get_author_image()中使用)

            Optional argument.

            可选参数。

            An array of configuration options.

            一系列配置选项。

              • author_id : default of current post author;

              • author_id:当前帖子作者的默认值;

                the id of the author to get the image for

              • 用于获取图片的作者的ID

              • before : default of ”;

              • 之前:默认为;

                text to show before each author

              • 在每位作者面前显示的文字

              • after : default of ”;

              • 之后:默认为;

                text to show after each author

              • 在每位作者之后显示的文字

              • image_dir : default of ”;

              • image_dir:默认为;

                directory containing author images, relative to wp-content directory

              • 包含作者图像的目录,相对于wp-content目录

              • width : default of ”;

              • width:默认为;

                width to display image

              • 显示图像的宽度

              • height : default of ”;

              • height:默认为;

                height to display image

              • 显示图像的高度

              • show_name : default of ” which means it’ll abide by the plugin’s setting value;

              • show_name:默认为”,表示它将遵守插件的设置值;

                should the name of the author be shown in addition to the image?

              • 除了图片,还应该显示作者的名字吗?

              • show_fullname : default of false;

              • show_fullname:默认为false;

                should the user’s first and last name be shown instead of the author’s configured display name?

                应该显示用户的名字和姓氏,而不是作者配置的显示名吗?

                (be sure to set ‘show_name’ to true if you want the name to appear in the first place)

              • (如果您希望名称首先出现,请确保将“ show_name”设置为true)

              • show_name_if_no_image : default of ” which means it’ll abide by the plugin’s setting value;

              • show_name_if_no_image:默认值为”,表示它将遵守插件的设置值;

                should the author’s name be shown if the author doesn’t have an image?

              • 如果作者没有图片,应该显示作者的名字吗?

              • class : default of ”;

              • class:默认为;

                array or string of classes to apply to author image tag

              • 适用于作者图像标签的类的数组或字符串

              • use_gravatar : default of plugin settings;

              • use_gravatar:插件设置的默认值;

                should Gravatar be consulted for an author image if no local image for the author was found?

              • 如果找不到作者的本地图片,应该咨询Gravatar获得作者图片吗?

            • $args (as used in c2c_wp_list_authors_images)

              $ args (在 c2c_wp_list_authors_images 中使用)

              Optional argument.

              可选参数。

              An array of configuration options.

              一系列配置选项。

              All but the last two match up with the supported arguments of the wp_list_authors() function.

              除了最后两个以外,所有其他内容均与 wp_list_authors()函数支持的参数匹配。

                • optioncount : default of false;
                • optioncount:默认为false;

                • exclude_admin : default of true;

                • exclude_admin:默认为true;

                  should the admin user be excluded from the listing?

                • 应该将管理员用户从列表中排除吗?

                • hide_empty : default of true;

                • hide_empty:默认为true;

                  should authors who have not made any posts be excluded from the listings?

                • 应该将没有发表任何帖子的作者从列表中排除吗?

                • feed : default of ”
                • feed:默认为“

                • feed_image : default of ”
                • feed_image:默认为

                • echo : default of true;

                • echo:默认为true;

                  should the listing be echoed to the page?

                • 列表应与页面呼应吗?

                • show_name : default of ” which means it’ll abide by the plugin’s setting value;

                • show_name:默认为”,表示它将遵守插件的设置值;

                  should the name of the author be shown in addition to the image?

                • 除了图片,还应该显示作者的名字吗?

                • show_fullname : default of false;

                • show_fullname:默认为false;

                  should the user’s first and last name be shown instead of the author’s configured display name?

                  应该显示用户的名字和姓氏,而不是作者配置的显示名吗?

                  (be sure to set ‘show_name’ to true if you want the name to appear in the first place)

                • (如果您希望名称首先出现,请确保将“ show_name”设置为true)

                • show_name_if_no_image : default of '' which means it’ll abide by the plugin’s setting value;

                • show_name_if_no_image:默认为'',这意味着它将遵守插件的设置值;

                  should the author’s name be shown if the author doesn’t have an image?

                • 如果作者没有图片,应该显示作者的名字吗?

                • before : default of ”;

                • 之前:默认为;

                  text to show before each author

                • 在每位作者面前显示的文字

                • after : default of ”;

                • 之后:默认为;

                  text to show after each author

                • 在每位作者之后显示的文字

                • image_dir : default of ”;

                • image_dir:默认为;

                  directory containing author images, relative to wp-content directory

                • 包含作者图像的目录,相对于wp-content目录

                • width : default of ”;

                • width:默认为;

                  width to display image

                • 显示图像的宽度

                • height : default of ”;

                • height:默认为;

                  height to display image

                • 显示图像的高度

                • class : default of ”;

                • class:默认为;

                  array or string of classes to apply to author image tag

                • 适用于作者图像标签的类的数组或字符串

                • use_gravatar : default of plugin settings;

                • use_gravatar:插件设置的默认值;

                  should Gravatar be consulted for an author image if no local image for the author was found?

                • 如果找不到作者的本地图片,应该咨询Gravatar获得作者图片吗?

              Examples

              示例

                • Show the author image for the current post’s author (must be “in the loop”)

                  显示当前帖子作者的作者图像(必须为“循环中”)

                • Get the author image from a different directory when on a post’s permalink page (for instance, show a larger image on the permalink page)

                  在帖子的永久链接页面上从其他目录获取作者图像(例如,在永久链接页面上显示较大的图像)

                • List all authors in the sidebar

                  在边栏中列出所有作者

                  • Change some default options when listing authors

                    在列出作者时更改一些默认选项

                         

                           

                        false, ‘show_name_if_no_image’ => true));

                        false,“ show_name_if_no_image” => true));

                        ?>

                        ?>

                      Filters

                      过滤器

                      The plugin exposes two filters and two actions for hooking.

                      该插件提供了两个过滤器和两个用于挂接的动作。

                      Typically, customizations utilizing these hooks would be put into your active theme’s functions.php file, or used by another plugin.

                      通常,利用这些钩子进行的自定义将被放入活动主题的functions.php文件中,或由另一个插件使用。

                    c2c_get_author_image (filter)

                    c2c_get_author_image(过滤器)

                    The 'c2c_get_author_image' hook allows you to use an alternative approach to safely invoke c2c_get_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't

                    通过“ c2c_get_author_image”钩子,您可以使用另一种方法安全地调用 c2c_get_author_image(),这样,如果停用或删除了插件,则对函数的调用不会

                    cause errors in your site.

                    导致您的网站出现错误。

                    Arguments:

                    参数:

                      • same as for c2c_get_author_image()
                      • c2c_get_author_image()

                      Example:

                      示例:

                      Instead of:

                      代替:

                           false ) );

                        <?php $ image = c2c_get_author_image(array('show_name'=> false)); 

                      ?>

                      ?>

                      Do:

                      做:

                           false ) );

                        <?php $ image = apply_filters('c2c_get_author_image',array('show_name'=> false)); 

                      ?>

                      ?>

                      c2c_get_the_author_image (filter)

                      c2c_get_the_author_image(过滤器)

                      The 'c2c_get_the_author_image' hook allows you to use an alternative approach to safely invoke c2c_get_the_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't

                      通过“ c2c_get_the_author_image”钩子,您可以使用另一种方法安全地调用 c2c_get_the_author_image(),这样,如果停用或删除了插件,则对函数的调用不会

                      cause errors in your site.

                      导致您的网站出现错误。

                      Arguments:

                      参数:

                        • same as for c2c_get_the_author_image()
                        • c2c_get_the_author_image() 相同

                        Example:

                        示例:

                        Instead of:

                        代替:

                            

                          <?php $ image = c2c_get_the_author_image(); 

                        ?>

                        ?>

                        Do:

                        做:

                            

                          <?php $ image = apply_filters('c2c_get_the_author_image',''); 

                        ?>

                        ?>

                        c2c_the_author_image (action)

                        c2c_the_author_image(操作)

                        The 'c2c_the_author_image' hook allows you to use an alternative approach to safely invoke c2c_the_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't

                        通过'c2c_the_author_image'挂钩,您可以使用另一种方法安全地调用 c2c_the_author_image(),这样,如果停用或删除了插件,则对函数的调用不会

                        cause errors in your site.

                        导致您的网站出现错误。

                        Arguments:

                        参数:

                          • same as for c2c_the_author_image()
                          • c2c_the_author_image()

                          Example:

                          示例:

                          Instead of:

                          代替:

                              ', '', '/images' );

                            <?php c2c_the_author_image('','','/ images'); 

                          ?>

                          ?>

                          Do:

                          做:

                              ', '', '/images' );

                            <?php echo do_action('c2c_the_author_image','','','/ images'); 

                          ?>

                          ?>

                          c2c_wp_list_authors_images (action)

                          c2c_wp_list_authors_images(操作)

                          The 'c2c_wp_list_authors_images' hook allows you to use an alternative approach to safely invoke c2c_wp_list_authors_images() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't

                          通过“ c2c_wp_list_authors_images”钩子,您可以使用另一种方法安全地调用 c2c_wp_list_authors_images(),这样,如果停用或删除了插件,则对函数的调用不会

                          cause errors in your site.

                          导致您的网站出现错误。

                          Arguments:

                          参数:

                            • same as for c2c_wp_list_authors_images()
                            • 与c2c_wp_list_authors_images()相同

                            Example:

                            示例:

                            Instead of:

                            代替:

                                 false ) );

                              <?php echo c2c_wp_list_authors_images(array('hide_empty'=> false));复制代码

                            ?>

                            ?>

                            Do:

                            做:

                                 false ) );

                              <?php echo do_action('c2c_wp_list_authors_images',array('hide_empty'=> false));复制代码

                            ?>

                            ?>

安装步骤

    1. Whether installing or updating, whether this plugin or any other, it is always advisable to back-up your data before starting
    2. 无论是安装还是更新(无论是此插件还是其他插件),始终建议在开始之前备份您的数据

    3. Unzip author-images.zip inside the /wp-content/plugins/ directory (or install via the built-in WordPress plugin installer)
    4. / wp-content / plugins / 目录中的 author-images.zip 解压缩(或通过内置的WordPress插件安装程序安装)

    5. Activate the plugin through the ‘Plugins’ admin menu in WordPress
    6. 通过WordPress中的“插件”管理菜单激活插件

    7. Go to the Users -> Author Images admin options page.

    8. 转到“用户->作者图像”管理选项页面。

      Optionally customize the options.

    9. (可选)自定义选项。

    10. Create the directory(s) that will contain author image(s) (path must be relative to wp-content/ directory) (by default this would be /wp-content/images/authors/)
    11. 创建将包含作者图像的目录(路径必须相对于wp-content /目录)(默认情况下为/ wp-content / images / authors /)

    12. Put images into the specified image directory, using the author login name or the author ID as the filename,

    13. 使用作者登录名或作者ID作为文件名,将图像放入指定的图像目录,

      with whatever extension you plan to support, i.e. admin.gif or 1.gif

    14. 具有您计划支持的任何扩展名,即admin.gif或1.gif

    15. (optional) Use the provided “Author Image(s)” widget, if so inclined.
    16. (可选)倾斜时使用提供的“作者图像”小部件。

    17. (optional) Modify your index.php and/or other template files to include calls to

    18. (可选)修改您的index.php和/或其他模板文件,以包含对 <?php的调用c2c_the_author_image();

      ?> and/or

      ?> 和/或

      .

      (Read the rest of these notes for more info.)

    19. (请阅读这些说明的其余部分以获取更多信息。)

    20. (optional) Add the custom field ‘author_image’ to posts to explicitly define an image for the author for just that post.

    21. (可选)在帖子中添加自定义字段“ author_image”,以便为该帖子明确为作者定义图片。

      Otherwise, the plugin will proceed to attempt to find the author image.

    22. 否则,插件将继续尝试查找作者图像。

    23. (optional) Add the class “author_image” to your CSS file to control the display of the image located by c2c_the_author_image(), and/or add the class “list_author_image” to your CSS file to

    24. (可选)将类“ author_image”添加到您的CSS文件中,以控制由 c2c_the_author_image()定位的图像的显示,和/或将类“ list_author_image”添加到您的CSS文件中,

      control the display of the images listed by c2c_wp_list_authors_images().

    25. 控制 c2c_wp_list_authors_images()列出的图像的显示。

下载地址
https://downloads.wordpress.org/plugin/author-images.3.6.zip
-EOF-

AI助手支持GPT4.0