WordPress.org

Ready to get started?Download WordPress

Forums

wp_title in author archives (3 posts)

  1. Ruby Sinreich
    Member
    Posted 8 years ago #

    Why doesn't wp_title() display the author's name on an author archive as it does for a category or date archive?

    I have tried using <?php the_author('namefl'); ?> but it seems to function in some places and not others. :-(

  2. Kafkaesqui

    Posted 8 years ago #

    "Why doesn't wp_title() display the author's name on an author archive as it does for a category or date archive?"

    It's a good question. But the answer is not to use the_author(), which is intended for use in The Loop. Try this instead:

    <?php
    if (is_author()) {
    global $author;
    $name = get_userdata($author);
    echo '&raquo; Posts by ' . $name->user_nickname;
    }
    ?>

    For a full name, change the echo line to:

    echo '&raquo; Posts by ' . $name->user_firstname . ' ' . $name->user_lastname;

  3. Ruby Sinreich
    Member
    Posted 8 years ago #

    Thanks! I will try this.

Topic Closed

This topic has been closed to new replies.

About this Topic