- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/get avatar
提供: WordPress Codex 日本語版
< 関数リファレンス
2010年3月3日 (水) 21:37時点におけるBono (トーク | 投稿記録)による版 (en:Function Reference/get_avatar 15:44, 30 November 2009 Otto42 版を翻訳用にコピー)
Description
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.
Usage
%%% <?php echo get_avatar( $id_or_email, $size, $default, $alt ); ?> %%%
Parameters
- $id_or_email
- (int/string/object) (必須) 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 useget_the_author_id()
(deprecated in WordPress 2.8). For WordPress 2.8, please useget_the_author_meta('user_email')
.- 初期値: なし
- $size
- (integer) (optional) Size of Gravatar to return (max is 512).
- 初期値: 96
- $default
- (string) (optional) url for an image, defaults to the "Mystery Man".
- 初期値: なし
- $alt
- (string) (optional) Alternate text for the avatar.
- 初期値: なし
Examples
<?php echo get_avatar( $comment, 32 ); ?>
Change Log
- Since: 2.5.0
Source File
get_avatar() is located in wp-includes/pluggable.php
.
最新英語版: WordPress Codex » Function Reference/get_avatar (最新版との差分)
Related
この記事は翻訳時に編集が必要であるとマークされていました。その為Codex原文が大きく編集されている可能性があります。内容を確認される際は原文を参照していただき、可能であれば本項目へ反映させてください。よりよいCodexを作成するためのお手伝いをお願いします。
関数リファレンス、テンプレートタグ目次もご覧ください。