Author tags

1)the_author()

Description
The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.
To return to PHP rather than displaying, use get_the_author(). Usage <?php the_author(); ?> Examples
<p>This post was written by <?php the_author(); ?></p>
Display Author's 'Public' Name Displays the value in the user's Display name publicly as field.

2)get_the_author()

Description
To get the post author's ID, use get_the_author_meta( 'ID' ).
Retrieve the post author's display name. This tag must be used within The Loop.
To display a page for authors which have no posts, see this discussion.

The author's display name.
Since WordPress 2.1 parameters are deprecated (not the function). Usage <?php $author = get_the_author(); ?> Parameters $deprecated (string) (optional) Deprecated. Default: '' Returns (string)
Examples
Grab the Author's 'Public' Name Grabs the value in the user's Display name publicly as field. <?php $author = get_the_author(); ?>

3)the_author_link()

Description
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.
Grab the Author's 'Public' Name Grabs the value in the user's Display name publicly as field. <?php $author = get_the_author(); ?>
Usage <?php the_author_link(); ?> Parameters
<p>Written by:
This function does not accept any parameters. Example Displays the author's Website URL as a link and the text for the link is the author's Profile Display name publicly as field. In this example, the author's Display Name is James Smith.
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.
<?php the_author_link(); ?></p>

4)get_the_author_link()

Description get_the_author_link() returns the link for use in PHP. To display the link instead, use the_author_link(). Usage <?php get_the_author_link(); ?> Parameters
The example echos (displays) the author's Website URL as a link and the text for the link is the author's Profile Display name publicly as field. In this example, the author's Display Name is James Smith.
<p>Written by:
<?php echo get_the_author_link(); ?></p>

5)the_author_meta()

Description
The the_author_meta Template Tag displays a desired meta data field for a user.
 Only one field is returned at a time, you need to specify which you want. 
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. 
If the meta field does not exist, nothing is printed. 
NOTE: Use get_the_author_meta() if you need to return (and do something with) the field, rather than just display it. 

Parameters
$field 
(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) (optional) If the user ID fields is used, then this function display the specific field for this user ID. 
Default: false 

Examples
Display the Author's AIM screenname
Displays the value in the author's AIM (AOL Instant Messenger screenname) field.

A plugin may add an additional field in the registration or manage users, which adds a new value in the wp_usermeta table (where wp_ is your data base prefix). For this example we will use a Twitter ID. For a meta_key value of "twitter" and meta_value of "WordPress" then
Display a User Email Address 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> Advanced Uses <p>This author's Twitter name is <?php the_author_meta('twitter'); ?></p>

6)the_author_posts()

Description
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. Usage <?php the_author_posts(); ?> Example Displays the author's name and number of posts. <p><?php the_author(); ?> has blogged <?php the_author_posts(); ?> posts</p>

No comments:

Post a Comment

=>SEO

1.  Syllabus 2.  Unit Wise Question/Material 3. Paper 4. Previous Paper