WordPress.org

Support

Support » How-To and Troubleshooting » How-to display author bio if it exists

How-to display author bio if it exists

  • In my single.php, I have a snippet that says if the post is in a particular category, then display the author’s bio. I’d like to place another IF statement to surround it so that if the author bio doesn’t exist then skip the whole thing. This is what I have

    <?php
    if (in_category(8)|in_category(9)|in_category(10)|in_category(11)|in_category(12)|in_category(14)|in_category(18))
    {
    echo ‘<h6>About the author</h6>’;
    echo ‘<em style=”font-size:85%;”>’;
    echo the_author_description();
    echo ”;
    }
    ?>

    So I want to place an IF so that this will only execite if the author bio doesn’t equal null.

    Thanks,
    Carlos

Viewing 1 replies (of 1 total)
  • Ian Stewart

    @iandstewart

    Theme Wrangler

    if ( get_the_author_meta('description') ) : // If a user has filled out their decscription show a bio on their entries
        // do stuff
    endif;

    Works for me!

Viewing 1 replies (of 1 total)
  • The topic ‘How-to display author bio if it exists’ is closed to new replies.
Skip to toolbar