Forums

[resolved] Checking If Author Bio Is Blank (3 posts)

  1. gmd8
    Member
    Posted 2 years ago #

    Hi There- I'm creating a WordPress theme and am trying to figure out if the author of a post's bio is blank so that I won't have a big blank area in my theme- it the author does have a filled in bio, I'd like to display it. On my single post files, I have this test code, but it is always reading that the author does not have a description. What am I doing wrong? Thanks.

    <?php
    
    if ( empty($curauth->description) ) {
    	echo 'This author does not have a description.';
    } else {
    	echo 'This author does have a description.';
    }
    
    ?>
  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Do you have this before that if test?

    $curauth = get_userdata($post->post_author); //get data for current post author
  3. gmd8
    Member
    Posted 2 years ago #

    I used something very similar to that with $curauth but not that- after replacing the code with that, it works! Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic