WordPress Cheat Sheet / Tags – Part 2 [Author Tags]

Hello Friends,
Hope you are well. Today, I am going to introduce about the Author Tag for you. Tomorrow, we will be introduce about the Blog Info Tags. Hope, you will enjoy it. This is the second post of wordpress Tags / Cheat Sheet.

The Author the_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.

Get The Author get_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.

The Author Link the_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 Meta the_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

Type: 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_lastname
  • user_description
  • rich_editing
  • comment_shortcuts
  • admin_color
  • plugins_per_page
  • plugins_last_view
  • ID

$userID

Type: Integer

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. 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.

<?php wp_dropdown_users($args); ?>

show_option_all

Type: String

Causes the HTML for the dropdown to allow you to select all of the users.


show_option_none

Type: String

Causes the HTML for the dropdown to allow you to select none of the users.


orderby

Type: String

Key to sort options by. Valid values:

  • ‘ID’
  • ‘user_nicename’
  • ‘display_name’ – Default

order

Type: String

Sort order for options. Valid values:

  • ‘ASC’ – Default
  • ‘DESC’

include

Type: String

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 exclude all.


exclude

Type: String

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 exclude nothing.


multi

Type: Boolean

Whether to skip the ID attribute on the ‘select’ element. Defaults to False.


show

Type: String

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’ – Default

selected

Type: Integer

User ID of the user to be ‘selected’ or presented in the display box. Defaults to no user selected.


name

Type: String

Name assigned to the dropdown form. Defaults to ‘user’.


class

Type: String

Class assinged to the dropdown form.

WP List Authorswp_list_authors();

Create dropdown HTML content of users.

<?php wp_list_authors($args); ?>

optioncount

Type: Boolean

Display number of posts by each other. Default: False.


exclude_admin

Type: Boolean

Exclude the ‘admin’ (login is admin) account from authors list. Default: True.


show_fullname

Type: Boolean

Display the full (first and last) name of the authors. If false, the “Display name publicly as” is displayed. Default: False.


hide_empty

Type: Boolean

Do not display authors with 0 posts. Default: True.


echo

Type: Boolean

Display the results. Default: True.


feed

Type: String

Text to display for a link to each author’s RSS feed. Default is no text, and no feed displayed.


feed_image

Type: String

Path/filename for a graphic. This acts as a link to each author’s RSS feed, and overrides the feed parameter.


style

Type: String

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. This option was added with Version 2.8. Valid values:

  • list – Default
  • none

html

Type: Boolean

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. This option was added with Version 2.8. Default: True.

Thanks for reading this tuts. Hope, you enjoyed this very well. Keep in touch and Wait for Next.

Bye

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s