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've implemented this code inside my author.php file, in order to display the username of the author:

<?php printf( "<h4>The blog of<a href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></h4>" ); ?>

It displays correctly the username of a user who has posted articles, but unfortunately displays another username when the user hasn't published anything.

Is there a way to solve that ? Thanks for your help !

share|improve this question
add comment

1 Answer 1

Take a look at the codex page on author templates - Author Templates

Especially the $curauth object.

In order to display author information on your author page, edit your author template file - author.php so that it figures out which author is being viewed, and retrieves all the information about the author from the database (i.e. the information entered in the User administration screen of WordPress). This is done by setting up a variable called $curauth (Current Author).

Quote Source - Wordpress Codex / Custom Author Information

share|improve this answer
    
Thanks Alex, the problem is that these kind of functions don't display the username when the user has not posted anything. In fact, I want author pages not only for authors but for users too... –  Job78 Jul 13 '11 at 11:09
1  
From what I can tell from working on a project recently if a user is registered they are considered an author in so much they will have a page. You can create an author.php template and go wild with it. –  Alex Older Jul 15 '11 at 7:21
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.