If function returns value... (3 posts)

  1. anthonyb
    Posted 5 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 5 years ago #

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


  3. anthonyb
    Posted 5 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic