the_author_meta

Sponsored Link

the_author_metaテンプレートタグは、ユーザーが希望するメタデータを表示します。このタグはループ内で使用される場合、ユーザーIDの値は指定する必要がなく、データは現在の記事の著者を表示します。

Sponsored Link

The the_author_meta Template Tag displays the desired meta data for a user. If this tag is used within The Loop, the user ID value need not be specified, and the displayed data is that of the current post author. A user ID can be specified if this tag is used outside The Loop.

注:情報を返す(表示されません)必要がある場合、get_the_author_meta()を使用してください。

NOTE: Use get_the_author_meta() if you need to return (not display) the information.

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

<?php the_author_meta( $field, $userID ); ?> 

the_author_metaのパラメーター

$field

(string) データ項目のフィールド名が表示されます。有効な値:

(string) Field name for the data item to be displayed. Valid values:

  • 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のフィールドを使用する場合、この関数はユーザーIDの特定のフィールドを表示します。

(integer) If the user ID fields is used, then this function display the specific field for this user ID.

著者のAIMスクリーン名を表示する方法

著者のAIM(AOL Instant Messenger screenname)フィールドに値を表示します。

Displays the value in the author’s AIM (AOL Instant Messenger screenname) field.

<p>This author's AIM address is<?php the_author_meta('aim'); ?></p>

ユーザーのメールアドレスを表示する方法

ユーザーID25のメールアドレスを表示します。

Displays the email address for user ID 25.

<p>The email address for user id 25 is<?php the_author_meta('user_email',25); ?></p>

高度な使用

プラグインがwp_usermetaに新しい値を追加することで、ユーザー登録やユーザー管理に追加フィールドを追加することができます(wp_ isはデータベースの接頭語です。例えば、私たちは、プラグインがmeta_key値に”twitter”やmeta_valueに”wordpress”を設定する場合、TwitterのIDを使用します)

A plugin may add an additional field in the registration or manage users, which adds a new value in the wp_usermeta (where wp_ is your data base prefix. For this example we will use a Twitter ID if a plugin set meta_key value to “twitter” and meta_value to “wordpress” then

<p>This author's Twitter name is<?php the_author_meta('twitter'); ?></p>

表示

would return

This author’s Twitter name is wordpress

変更ログ

Since: 2.8.0

ソースファイル

the_author_meta()は、wp-includes/author-template.php内に位置しています。

the_author_meta() is located in wp-includes/author-template.php.

関連テンプレートタグ

the_author, the_author_link, get_the_author_link, the_author_posts, the_author_posts_link, wp_list_authors, wp_dropdown_users, the_author_meta

Sponsored Link