WordPress.org

Ready to get started?Download WordPress

Forums

If function returns value... (3 posts)

  1. anthonyb
    Member
    Posted 3 years ago #

    Hey there,

    I was recently building an author template and wanted to implement a function such as :
    <?php the_author_meta( 'description' ); ?>

    RIght now if the description is empty, it won't display anything. This is fine, however, if I wanted to wrap that meta information like so:
    <div><?php the_author_meta( 'description' ); ?></div>

    How can I make something like this work? I want to not return any information if the description isn't filled out. But if it is, I'd like to wrap something like a div around it.

    Is there some global way of doing something like this that I can use for other functions?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    <?php if( get_the_author_meta('description') :?>
    <div><?php the_author_meta( 'description' ); ?></div>
    <?php endif;?>

    http://codex.wordpress.org/Function_Reference/the_author_meta

  3. anthonyb
    Member
    Posted 3 years ago #

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic