- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「テンプレートタグ/the author meta」の版間の差分
Takahashi Fumiki (トーク | 投稿記録) (訳了) |
細 (→Source File: Template:BrowseSource 引数変更に伴い修正。) |
||
76行目: | 76行目: | ||
== Source File == | == Source File == | ||
− | <tt>the_author_meta()</tt> is located in {{BrowseSource|wp-includes/author-template.php | + | <tt>the_author_meta()</tt> is located in {{BrowseSource|wp-includes/author-template.php}}. |
<div id="Related"> | <div id="Related"> | ||
+ | |||
== 関連情報 == | == 関連情報 == | ||
</div> | </div> |
2009年11月8日 (日) 00:54時点における版
このページ「テンプレートタグ/the author meta」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
目次
解説
the_author_metaテンプレートタグを使えば、あるユーザーが持つメタデータから好きなものを表示することができます。このタグをループの中で使った場合、ユーザーIDを指定する必要はありません。表示されるデータは現在の投稿の作者のものになります。ループの外で使われた場合、ユーザーIDを指定する必要があります。
この情報を戻り値(表示しないPHPの変数)として使用したいならば、get_the_author_meta()/enを使ってください。
注意: the_author_metaはVersion 2.8から使用可能になりました。
使用法
<?php the_author_meta( $field, $userID ); ?>
パラメータ
- $field
- (string) 表示したいデータのフィールド名。有効な値は...
- user_login
- user_pass
- user_nicename
- user_email
- user_url
- user_registered
- user_activation_key
- user_status
- display_name
- nickname
- first_name
- last_name
- description
- jabber
- aim
- yim
- user_level
- user_firstname
- user_lastname
- user_description
- rich_editing
- comment_shortcuts
- admin_color
- plugins_per_page
- plugins_last_view
- ID
- $userID
- (integer) これが指定されると、このIDを持つユーザーの情報が表示されます。
例
投稿作成者のAIMアカウント名を表示する
投稿作成者のAIM (AOL Instant Messengerアカウント)フィールドを表示します。
<p>この著者のAIMアカウントは<?php the_author_meta('aim'); ?>です。</p>
特定のユーザーのメールアドレスを表示する
ユーザーID25のメールアドレスを表示します。
<p>ID25のユーザーのアドレスは<?php the_author_meta('user_email',25); ?>です。</p>
変更履歴
- 2.8 : 新規テンプレートタグ
Source File
the_author_meta() is located in wp-includes/author-template.php
.
関連情報
作成者タグ:
the_author(),
get_the_author(),
the_author_link(),
get_the_author_link(),
the_author_meta(),
get_the_author_meta(),
the_author_posts(),
get_the_author_posts(),
the_author_posts_link(),
get_author_posts_url(),
get_the_modified_author(),
the_modified_author(),
wp_dropdown_users(),
wp_list_authors()
最新英語版: WordPress Codex » Template Tags/the_author_meta (最新版との差分)