Hide Blank Profile Fields From Author Profile Page? (2 posts)

  1. spelchek
    Posted 8 years ago #

    So I'm building an author.php page for my site and I want to able to hide a field if the author left it blank in their profile field.

    My site looks like

    Number of Posts: 25
    Percentage of Posts on the Site: 86.21%
    Website: http://www.ihopeyourearsbleed.com
    Last.FM: http://www.last.fm/user/skinnymckinney
    Aim: n/a

    But would like to make it so that if they don't specify one, i can hide that whole line.

    Any pointers?

  2. Mindshare Labs, Inc.
    Posted 7 years ago #

    Try something like this:

    <?php if (get_the_author_url()) { ?>
    <a href="<?php the_author_url(); ?>"><?php the_author(); ?></a>
    <?php } else { the_author(); } ?>

    Hope that helps (even if it's a bit late!)
    More info: http://codex.wordpress.org/Template_Tags#Author_tags

Topic Closed

This topic has been closed to new replies.

About this Topic