Display author name in WordPress authors archive, outside the loop


Usually WordPress on its Author Archives pages — if (is_author()) — includes only the general title “Archive of authors”. This is not enough if a blog publishes posts by several authors. In such a case you may want to have also the name of the particular author of the posts being displayed. You can do this by editing the archive.php file of your WordPress theme. Find the author conditional if (is_author()) { ?> and add the following code:

<?php $author = get_userdata( get_query_var('author') );?>

Then apply some CSS style and display the name of the author, e.g:

<p style="font-size:25pt;"><?php echo $author->display_name;?></p>

Report a problem on this page / Make a Request
Get The Power & Follow! don't miss   : :   Sleeper   Favorite Launcher   Savy   Gadgetarian
Fling   Power Copy   Windows Rule   SearchALL Gadget   Amazon Gadget

1 Response

  1. wellseo says:

    Thank you. I need exactly this for a customer. Thank you! Very usefull – bookmarked for the next projects.