- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「テンプレートタグ/the author meta」の版間の差分
細 (言語間リンク等挿入、リンク調整/未翻訳) |
Takahashi Fumiki (トーク | 投稿記録) (訳了) |
||
1行目: | 1行目: | ||
{{NeedTrans}} | {{NeedTrans}} | ||
− | = | + | <div id="Description"> |
+ | == 解説 == | ||
+ | </div> | ||
− | + | '''the_author_meta'''テンプレートタグを使えば、あるユーザーが持つメタデータから好きなものを表示することができます。このタグを[[The Loop|ループ]]の中で使った場合、ユーザーIDを指定する必要はありません。表示されるデータは現在の投稿の作者のものになります。[[The Loop|ループ]]の外で使われた場合、ユーザーIDを指定する必要があります。 | |
− | + | この情報を戻り値(表示しないPHPの変数)として使用したいならば、[[関数リファレンス/get_the_author_meta|get_the_author_meta()]]/[[:en:Function Reference/get_the_author_meta|en]]を使ってください。 | |
− | + | 注意: '''the_author_meta'''は[[Version 2.8]]から使用可能になりました。 | |
− | = | + | <div id="Usage"> |
+ | == 使用法 == | ||
+ | </div> | ||
<?php the_author_meta( $field, $userID ); ?> | <?php the_author_meta( $field, $userID ); ?> | ||
− | = | + | <div id="Parameters"> |
+ | == パラメータ == | ||
+ | </div> | ||
− | ; $field : (''string'') | + | ; $field : (''string'') 表示したいデータのフィールド名。有効な値は... |
:*<tt>user_login</tt> | :*<tt>user_login</tt> | ||
:*<tt>user_pass</tt> | :*<tt>user_pass</tt> | ||
42行目: | 48行目: | ||
:*<tt>ID</tt> | :*<tt>ID</tt> | ||
− | ; $userID : (''integer'') | + | ; $userID : (''integer'') これが指定されると、このIDを持つユーザーの情報が表示されます。 |
− | = | + | <div id="Examples"> |
+ | == 例 == | ||
+ | </div> | ||
− | === | + | <div id="Display_the_Author's_AIM_screenname"> |
+ | === 投稿作成者のAIMアカウント名を表示する === | ||
+ | </div> | ||
− | + | 投稿作成者の'''AIM''' (AOL Instant Messengerアカウント)フィールドを表示します。 | |
− | <p> | + | <p>この著者のAIMアカウントは<?php the_author_meta('aim'); ?>です。</p> |
− | === | + | <div id="Display_a_User_Email_Address"> |
+ | === 特定のユーザーのメールアドレスを表示する === | ||
+ | </div> | ||
− | + | ユーザーID25のメールアドレスを表示します。 | |
− | <p> | + | <p>ID25のユーザーのアドレスは<?php the_author_meta('user_email',25); ?>です。</p> |
== 変更履歴 == | == 変更履歴 == | ||
66行目: | 78行目: | ||
<tt>the_author_meta()</tt> is located in {{BrowseSource|wp-includes/author-template.php|trunk|2.8}}. | <tt>the_author_meta()</tt> is located in {{BrowseSource|wp-includes/author-template.php|trunk|2.8}}. | ||
− | = | + | <div id="Related"> |
+ | == 関連情報 == | ||
+ | </div> | ||
{{Tag Author Tags}} | {{Tag Author Tags}} |
2009年8月8日 (土) 03:28時点における版
このページ「テンプレートタグ/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 構文エラー: "trunk" は認識できません/src/wp-includes/author-template.php 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 (最新版との差分)