Forums

Hiding labels on author page for empty fields (2 posts)

  1. RenFromPenn
    Member
    Posted 2 years ago #

    Hi,

    I am building a custom author.php page to include some additional fields that I have provided to my users. One field that I provide them with is for their AIM ID. So, to add that to the author page I have included

    AIM: <?php echo $curauth->aim; ?>

    The problem, however, is that AIM: is displayed on the author page even if the user didn't enter an AIM ID. Can someone please tell me how I could wrap that in an if clause so that the AIM label would only appear if $curauth->aim; isn't empty?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    <?php if( get_the_author_meta('aim', $curauth->ID) != '') :?>
    [ do stuff ]
    <?php endif;?>

Topic Closed

This topic has been closed to new replies.

About this Topic