An author ID is the unique numeric identifier for any user on a WordPress site. The first user created on a new WordPress site generally has an ID with a value of 1.
Although it is rare that you'll have a numeric user ID without direct programmatic input, you can use this technique when defining custom template tags. We're going to create a custom function that prints a user's username and their e-mail address.
You will need a theme that already has an author.php
file created, such as Sandbox from plaintxt.org, or you can create your own basic author.php
theme file by adding the code provided in this recipe.
First, open or create your theme's author.php
file.
Place your cursor at the beginning of the author.php
file, and then insert the following code:
<p> <b>Our guest author this week</b> <?php $user_info = get_userdata(2); echo($user_info->user_nicename . ' has this email address:' . $user_info...