ifacethoughts

authordata

All the information about author of the post being displayed or current post in the WordPress loop is stored in this global variable. It is set in the function setup_postdata($post) defined in [wordpress root folder]/wp-includes/functions.php. setup_postdata($post) is invoked in the WordPress loop on the current post.

WordPress provides a set of functions to retrieve the author information. This global variable need not be directly accessed by the plugin or theme developers.

In the list below, all the get_the_author_* functions have the_author_* counterparts. The get_the_author_* functions return the value whereas the_author_* functions display (echo) it.

The functions are:

  • get_the_author() returns the author’s display name.
  • get_the_author_description() returns the author’s profile.
  • get_the_author_login() returns the author’s username.
  • get_the_author_firstname() returns the author’s first name.
  • get_the_author_lastname() returns the author’s last name.
  • get_the_author_nickname() returns the author’s nickname.
  • get_the_author_ID() returns the author’s login ID.
  • get_the_author_email() returns the author’s email address.
  • get_the_author_url() returns URL of the author’s website.
  • get_the_author_icq() returns the author’s ICQ ID.
  • get_the_author_aim() returns the author’s AIM ID.
  • get_the_author_yim() returns the author’s Yahoo! Messenger ID.
  • get_the_author_msn() returns the author’s MSN Messenger ID.
  • get_the_author_posts() returns the author’s posts.
  • the_author_posts_link() displays link to all posts by the author.

In addition to this there are some more functions that can be used to retrieve details of specified author, they work even outside the WordPress loop.

  • get_author_link($echo = false, $author_id, $author_nicename) return link to all posts by the author.
  • wp_list_authors($args = '') lists links to all the authors, every link leading to all posts by an author. The arguments it takes are
    • option_count: true/false
    • exclude_admin: true/false
    • show_fullname: true/false
    • hide_empty: true/false
    • feed: feed name
    • feed_image: path to feed image

Back to full list of global variables.

Technorati tags: , , , ,

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    [...] $authordata [...]

  2. fff anal said:

    Welcome!!! fff anal

  3. Wordpress Global Variables | iface thoughts said:

    [...] $authordata [...]

  4. Abhijit Nadgouda’s List of WordPress Global Variables « Lorelle on WordPress said:

    [...] posts, more, posts_per_page, max_num_pages, numpages, page, pages, multipage, paged, post, id, authordata, post_cache, category_cache, and [...]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.