tfrommen/adorable-avatars

此插件将 Adorable Avatars 头像占位服务集成到 WordPress。

安装: 9

依赖: 0

建议: 0

安全: 0

星标: 4

关注者: 2

分支: 2

开放问题: 1

类型:wordpress-plugin

v2.1.0 2017-01-04 15:40 UTC

This package is auto-updated.

Last update: 2024-08-26 20:21:04 UTC


README

Version Status Build Downloads License

此插件将 Adorable Avatars 头像占位服务集成到 WordPress。

安装

  1. 下载 ZIP.
  2. 将内容上传到您的 Web 服务器上的 /wp-content/plugins 目录。
  3. 通过 WordPress 中的 插件 菜单激活插件。
  4. 在 WordPress 后端的 讨论设置 页面上选择 Adorable Avatars 作为默认头像设置。

过滤器

需要自定义任何内容?只需使用提供的过滤器。

adorable_avatars.force

如果您想在您的网站上全面使用 Adorable Avatars(即不仅作为默认头像,当没有 Gravatar 时),请使用此过滤器。

参数

  • bool $force 强制使用 Adorable Avatars?
  • mixed $id_or_email 用户标识符。
  • array $args 头像参数。

使用示例

无论什么情况下都使用 Adorable Avatars

<?php

add_filter( 'adorable_avatars.force', '__return_true' );

为除了 ID 为 42 的用户之外的所有人使用 Adorable Avatars

<?php

add_filter( 'adorable_avatars.force', function ( $force, $id_or_email ) {

	if ( is_numeric( $id_or_email ) ) {
		$id_or_email = (int) $id_or_email;
	} elseif ( $id_or_email instanceof WP_Post ) {
		$id_or_email = $id_or_email->ID;
	} elseif ( $id_or_email instanceof WP_Comment ) {
		$id_or_email = $id_or_email->user_id;
	}

	return 42 !== $id_or_email;
}, 10, 2 );

截图

Setting
默认头像设置 - 在这里,您可以选择 Adorable Avatars 作为默认头像设置。

贡献

如果您有功能请求,或者您已经开发了该功能,请随时使用问题和/或拉取请求部分。

当然,如果您想使用该插件在其他尚未包含的语言中,也可以提供翻译

许可

版权 (c) 2016 Thorsten Frommen

此代码受 MIT 许可证 许可。