Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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;
share|improve this answer
add comment

I once wrote a Wordpress Plugin called

Show authors without posts

feel free to use it...

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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