1

I'm building a meet the team page, which will be included all team members. I'm using the author.php file template.

I have a page that shows all authors (it works with authors who have no posts). When clicked it redirects to the author page.

There, everything works fine if the author has posts, but I want it to show all authors.

As simple as outputing the author's name:

<?php the_author_meta('first_name') . ' ' . the_author_meta('last_name'); ?>

Only works if the author has posts. How can I display the author, even if he has not posts at all?

2

1 Answer 1

2

You can use the get_queried_object where the CODEX says:

if you're on an author archive, it will return the author object

So since you have an object, you can return it values:

$author = get_queried_object();
echo $author->first_name . ' ' . $author->last_name;

And you can use the same parameters as get_the_author_meta():

user_login
user_pass
user_nicename
user_email
user_url
user_registered
user_activation_key
user_status
roles
display_name
nickname
first_name
last_name
description (Biographical Info from the user's profile)
jabber
aim
yim
googleplus
twitter
user_level
user_firstname
user_lastname
rich_editing
comment_shortcuts
admin_color
plugins_per_page
plugins_last_view
ID
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.