I cracked it!
In my case I first created an author.php page (my theme lacked one) from the archive.php by cloning and cleaning it.
Then I found this piece of code:
<?php if ( have_posts() ) : ?>
It basically says: if the authors has published some posts, then...
Well, I just added: "OR NOT!"
<?php if ( have_posts() || !have_posts() ) : ?>
And it works beautifully (see here)! The "OR NOT" is "||
= OR" and "!
= NOT".
Also, I had to change the way the template was retrieving the Author's avatar, because get_avatar
does not work correctly if the Author/User hasn't published anything yet, or if his/her posts are all still "Private" and not "Public".
I studied the Codex and came upon the following solution. Instead of:
echo get_avatar( get_the_author_meta( 'ID' ), 80 );
I use:
get_avatar( $curauth->ID, 80 );
You have to set the $curauth
variable properly first thing after the get_header
function, though.
get_header();
$curauth = (get_query_var('author_name'))
? get_user_by('slug', get_query_var('author_name'))
: get_userdata(get_query_var('author'));