WordPress.org

Ready to get started?Download WordPress

Forums

Cannot make the_author template tag work properly (2 posts)

  1. hendersonl
    Member
    Posted 2 years ago #

    I am attempting to design my first WordPress theme. I am an experienced website designer with a good knowledge of HTML and CSS. I am not a developer and have only a rudimentary knowledge of PHP.

    I want to set up a template page that will display the author's name on the post as a byline. In order to do this, of course, I need the author's first and last name to be displayed, not the author's nickname or login name.

    Here's the code at the beginning of the template page I've been working on

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Everything I've tried with this will display only the nickname, not the author's full name.

    Any suggestions on what I'm doing wrong?

    Thanks.

    L.

  2. hendersonl
    Member
    Posted 2 years ago #

    OK, so I was able to get it to work by changing

    <p class="byline01"><?php the_author('namefl') ?></p>

    to

    <p class="byline01"><?php the_author_meta('first_name') ?> <?php the_author_meta('last_name') ?></p>

    That seems a bit clumsy and awkward to me. Is there a better way of doing it?

    L.

Topic Closed

This topic has been closed to new replies.

About this Topic