WordPress.org

Ready to get started?Download WordPress

Forums

How-to display author bio if it exists (2 posts)

  1. idevgames
    Member
    Posted 5 years ago #

    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

  2. Ian Stewart
    Theme Wrangler
    Posted 4 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic