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 want to control when the author box is showed in my WordPress theme. It is showed in two pages: single.php and author.php.

For the single.php page I already created an option to enable/disable this option, so it will be a choice of the webmaster through the options page.

For the author.php I would like to make it without options. Totally automatic. If it has information to show, display it, if not, don't display it. And it is at this point where I have my question. Which parameters should I take in consideration to show it or not. At the first moment I planned:

if (the_author_meta('description') {
//Show this

But I think it is not a smart way to solve that point. I listed the information to show:

  • The avatar
  • User first name
  • User last name
  • Description
  • Website
  • Twitter
  • Facebook
  • Google Plus
  • Linkedin

So, it would be something like that:

$authorfn = get_the_author_meta('user_firstname');
$authorln = get_the_author_meta('user_lastname');
$authordesc = the_author_meta('description');
if (($authorfn || $authorln) && $authordesc) {
//Show this

What would you do?

  1. If the firstname AND the lastname AND the description
  2. If the firstname OR the lastname AND the description
  3. If the firstname OR the lastname OR the description
  4. If the firstname OR the lastname
  5. ...

Which parameters would you take in consideration to show the author box information automatically?

Edit: I will use this solution:

_e('Author: ', 'wp-theme');
echo get_the_author();

$authorfn = get_the_author_meta('user_firstname');
$authorln = get_the_author_meta('user_lastname');

    if ($authorfn || $authorln) {
        echo ' / ';
        _e('Name: ', 'wp-theme');
        echo the_author_meta('user_firstname');
        echo ' ';
        echo the_author_meta('user_lastname');
share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.