WordPress V3.xTemplate Tag Reference Guide as of Version 3.x
Presented by:
Author Tags
Get Author Posts URLget_author_posts_url();
Gets the URL of the author page for the author with a given ID.
<?php get_author_posts_url($author_id, $author_nicename); ?>
$author_id
Integer • Default: none
ID of the author whose URL should be retrieved.
$author_nicename
String • Default: none
(Optional) User nicename.
Get The Authorget_the_author();
The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.
<?php $author = get_the_author(); ?>
No parameters.
Get The Author Linkget_the_author_link();
This tag returns a link to the Website for the author of a post. The Website field is set in the user's profile (Administration > Users > Your Profile). The text for the link is the author's Profile Display name publicly as field. This tag must be used within The Loop. get_the_author_link() returns the link for use in PHP. To display the link instead, use the_author_link().
<?php get_the_author_link(); ?>
No parameters.
The Authorthe_author();
The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.
<?php the_author(); ?>
No parameters.
The Author Linkthe_author_link();
This tag displays a link to the Website for the author of a post. The Website field is set in the user's profile (Administration > Profile > Your Profile). The text for the link is the author's Profile Display name publicly as field. This tag must be used within The Loop.
<?php the_author_link(); ?>
No parameters.
The Author Metathe_author_meta();
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. Use get_the_author_meta() if you need to return (not display) the information.
<?php the_author_meta($field, $userID); ?>
$field
String • Default: ''
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_lastname
- user_description
- rich_editing
- comment_shortcuts
- admin_color
- plugins_per_page
- plugins_last_view
- ID
$userID
Integer • Default: 0
If the user ID fields is used, then this function display the specific field for this user ID.
The Author Poststhe_author_posts();
Displays the total number of posts an author has published. Drafts and private posts aren't counted. This tag must be used within The Loop.
<?php the_author_posts(); ?>
No parameters.
The Author Posts Linkthe_author_posts_link();
Displays a link to all posts by an author. The link text is the user's Display name publicly as field. The results of clicking on the presented link will be controlled by the Template Hierarchy of Author Templates. Arguments are passed in as either an array or a query string. This tag must be used within The Loop.
<?php the_author_posts_link(); ?>
No parameters.
WP Dropdown Userswp_dropdown_users();
Create dropdown HTML content of users. Arguments are passed in as either an array or a query string.
$args = array( | ||||
'show_option_all' | => | null, | ||
'show_option_none' | => | null, | ||
'hide_if_only_one_author' | => | null, | ||
'orderby' | => | 'display_name', | ||
'order' | => | 'ASC', | ||
'include' | => | null, | ||
'exclude' | => | null, | ||
'multi' | => | false, | ||
'show' | => | 'display_name', | ||
'echo' | => | true, | ||
'selected' | => | false, | ||
'include_selected' | => | false, | ||
'name' | => | 'user', | ||
'id' | => | null, | ||
'class' | => | null, | ||
'blog_id' | => | $GLOBALS['blog_id'], | ||
'who' | => | null | ||
); |
<?php wp_dropdown_users($args); ?>
show_option_all
String • Default: null
Causes the HTML for the dropdown to allow you to select all of the users.
show_option_none
String • Default: null
Causes the HTML for the dropdown to allow you to select none of the users.
orderby
String • Default: 'display_name'
Key to sort options by. Valid values:
- 'ID'
- 'user_nicename'
- 'display_name'
order
String • Default: 'ASC'
Sort order for options. Valid values: 'ASC' or 'DESC'
include
String • Default: null
Comma separated list of users IDs to include. For example, 'include=4,12' means users IDs 4 and 12 will be displayed/echoed or returned. Defaults to null, which includes all.
exclude
String • Default: null
Comma separated list of users IDs to exclude. For example, 'exclude=4,12' means users IDs 4 and 12 will NOT be displayed/echoed or returned. Defaults to null, which excludes nothing.
multi
Boolean • Default: false
Whether to skip the ID attribute on the 'select' element.
show
String • Default: 'display_name'
User table column to display. If the selected item is empty then the user_login will be displayed in parenthesis.
- 'ID'
- 'user_login'
- 'display_name'
echo
Boolean • Default: true
Display users (true) or return them for use by PHP (false).
selected
Integer • Default: no user selected
User ID of the user to be 'selected' or presented in the display box.
include_selected
Boolean • Default:false
Always include the selected user ID in the dropdown.
name
String • Default: 'user'
Name assigned to the dropdown form.
id
String • Default: value of the 'name' parameter
ID attribute of select element.
class
String • Default: null
Class assinged to the dropdown form.
blog_id
Integer • Default: ID of current blog
ID of blog.
who
String • Default: all users • Introduced version 3.1
Which users to query. Currently only 'authors' is supported.
WP List Authorswp_list_authors();
Create dropdown HTML content of users. Arguments are passed in as either an array or a query string.
$args = array( | ||||
'orderby' | => | 'name', | ||
'order' | => | 'ASC', | ||
'number' | => | null, | ||
'optioncount' | => | false, | ||
'exclude_admin' | => | true, | ||
'show_fullname' | => | false, | ||
'hide_empty' | => | true, | ||
'echo' | => | true, | ||
'feed' | => | '', | ||
'feed_image' | => | '', | ||
'feed_type' | => | '', | ||
'style' | => | 'list', | ||
'html' | => | true | ||
); |
<?php wp_list_authors($args); ?>
orderby
String • Default: 'name'
Field to use to sort the results. This argument was introduced in Version 3.1.
Valid values:
- name - display_name from users table
- email - user_email from users table
- url - user_url from users table
- registered - user_registered date from users table
- id - ID from users table
- user_login - user_login from users table
- post_count - based on number of posts by user
order
String • Default: 'ASC'
Order of results either ascending or descending. This argument was introduced in Version 3.1. Valid values are 'ASC' and 'DESC'.
number
Integer • Default: null, meaning no limit
The maximum number of users to display. This argument was introduced in Version 3.1.
optioncount
Boolean • Default: false
Whether to display number of posts by each author.
exclude_admin
Boolean • Default: true
Exclude the 'admin' (login is admin) account from authors list.
show_fullname
Boolean • Default: false
Display the full (first and last) name of the authors. If false, the "Display name publicly as" is displayed.
hide_empty
Boolean • Default: true
Whether to hide authors with 0 posts.
echo
Boolean • Default: true
Echo the results (true) or return them as a value for a php variable (false).
feed
String • Default '' - (no feed displayed)
Text to display for a link to each author's RSS feed.
feed_image
String • Default '' - (no feed image displayed)
Path/filename for a graphic. This acts as a link to each author's RSS feed, and overrides the feed parameter.
feed_type
String • Default: '' - (no feed type)
The type of feed. Valid values:
- rss2
- atom
- rss
- rdf
style
String • Default: 'list'
Style in which to display the author list. A value of list, the default, displays the authors as an unordered list, while none generates no special display method (the list items are separated by comma). If html is false, this option is ignored. Valid values:
- list
- none
html
Boolean • Default: true
Whether to list the items in html or plaintext. The default setting is true. If html is false, the style setting is ignored and the items are returned, separated by comma.