[WP2.8 之变] 新增模板标签:the_author_meta

the_author_metaWordPress 2.8 中将要加入的一个新的模板标签,该标签用于显示和作者有关的信息。

the_author_meta 会显示关于作者的信息,可以在主循环(The Loop)中使用,也可在主循环之外使用。在主循环内使用时,不需指定用户 ID,显示的信息属于当前文章作者;在主循环之外使用则需要指定用户 ID。如果需要获得返回值而不是输出结果,可以使用 get_the_author_meta()

用法



用法示例

显示作者的 AIM 名

这个例子将显示作者的 AIM 名。AIM 名可在作者的个人档案中设定。

This author’s AIM address is

显示作者的邮件地址

这个例子将显示 ID 为 27 的用户的邮件地址。

The email address for user id 27 is

参数

the_author_meta 可接受两个参数,$field$userID。后者为可选。

$field

指定所需的作者信息。可以使用的值:

  • 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

如果指定了用户的 ID,那么将输出对应 ID 用户的相关信息。

(信息来源:WordPress Codex

This entry was posted in 主题相关 and tagged . Bookmark the permalink. Follow any comments here with the RSS feed for this post.

Leave a Reply

Your email is never published nor shared. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>