get_avatar

Sponsored Link

ユーザーIDかメールアドレスを提供しているユーザーにアバターを取得します。最も一般的にコメントセクションで使用されます。

この関数はプラグインですが、プラグイン作者が互換性の為に、gravatarの出力の代わりにget_avatar フィルターの使用に変更する事を望みます。

Sponsored Link

Retrieve the avatar for a user who provided a user ID or email address. Most commonly used in the comments section.

This function is pluggable, however plugin authors wishing to change the gravatar output should use the get_avatar filter instead, for compatibility purposes.

get_avatarのテンプレートタグ使用方法

<?php echo get_avatar( $id_or_email, $size, $default, $alt ); ?> 

get_avatarのパラメーター

id_or_email

(integer/string/object) (required) 著者のユーザID(整数または文字列)、電子メールアドレス(文字列)またはコメントループからのコメントオブジェクトです。
注:ほとんどのコメントは、ここでは、コメンターのグラバターを表示するための順序に$commentを使用する事ができます。他のテンプレートではループ内(WordPress2.7より以下)場合は、get_the_author_id()(WordPress2.8では非推奨)使用する事ができます。WordPress 2.8ではget_the_author_meta(‘user_email’)を使用して下さい。

(integer/string/object) (required) Author’s User ID (an integer or string), an E-mail Address (a string) or the comment object from the comment loop.
Note: with most comment templates you can use $comment here, in order to display the gravatar of the commenter. In other templates within The Loop (for WordPress 2.7 and lower), you can use get_the_author_id() (deprecated in WordPress 2.8). For WordPress 2.8, please use get_the_author_meta(‘user_email’).

Default: None

size

(integer) (optional) Gravatarのサイズを返します。(最大は512です)

(integer) (optional) Size of Gravatar to return (max is 512).

Default: 96

default

(string) (optional) 画像のURLです。デフォルト”ミステリーマン”です。

(string) (optional) url for an image, defaults to the “Mystery Man”.

Default: None

alt

(string) (optional) アバターの代替テキストです。

(string) (optional) Alternate text for the avatar.

Default: None

<?php echo get_avatar( $comment, 32 ); ?>

変更ログ

  • Since: 2.5.0

ソースファイル

get_avatar()は、下記内に位置しています。

get_avatar() is located in

  • wp-includes/pluggable.php (the latest stable version)
  • wp-includes/pluggable.php (the development version)

この記事は編集の必要としてマークされています。編集することによってコデックスを助けることができます。

This article is marked as in need of editing. You can help Codex by editing it.

関連テンプレートタグ

Sponsored Link