Author page – if no BIO, show some text.

Community Forums Forums General Discussion Author page – if no BIO, show some text.

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  gomlers 1 year, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #33614

    gomlers
    Participant
    Post count: 29

    I have a site with multiple authors.

    If an author doesn’t fill out anything in the BIO, I still want to show something at the top of http://www.domain.com/authors/username

    How can I accomplish this?

    I’m using the DECOR child theme.

    Something like this maybe: (??) But where do I put it?

    function check_author_bio() {
    $description = get_userdata($author['ID'])->user_description;
    if ($description !="") {
    return $description;
    } else {
    $description == "Test";
    return $description;
    }
    }

     

    #33638

    UT Mod
    Participant
    Post count: 159

    Hey, am not sure if this is the solution but you need to read this -

    LINK

    and just a heads-up, you might be working with ->
    get_the_author_meta('description');

    As stated in the writeup, it gives you the author description.

    #33925

    gomlers
    Participant
    Post count: 29

    I don’t think that is the answer I’m looking for(?) :)

    My author box is there already, but if the user hasn’t put anything in the bio-field, I would like to write something like: “You haven’t written anything about yourself. You can do that here: LINK.”

    Which file would I need to be looking at?

    #33926

    UT Mod
    Participant
    Post count: 159

    I meant that you can use get_the_author_meta(‘description’) to suit your need by using it in the if-else loop based on the availability or null-ness of ‘description’.

    On the second part, I right now have no clue of where you’ll put it as we have not used author bio on our hyperlocal news site. But, surely someone from the community can assist you on this. And meanwhile I will also be digging-in to find out any solution about this and will let you know.

    #34106

    gomlers
    Participant
    Post count: 29

    Thank you very much for your efforts.
    All I can say, is that it does not work to put it in the functions.php :p

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.