Show author archive pages for authors with no posts

I have one page for each author, but if the author doesn’t have any posts I can’t get its variables, because the loop is empty.
The page returns empty, no avatar, no info and stuff, the whole site is empty.

How do I get WordPress to pull out the author variable if there are no posts (what makes no author, but i am on the authors page)..?

I’m using twentyeleven as parent theme.

5 Answers
5

To access the author user object outside of the loop on an author archive, you can do the following:

global $curauth;
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
echo 'This is the author page of '.$curauth->display_name;

Leave a Comment