WordPress.org

Support

Support » Themes and Templates » wp_title in author archives

wp_title in author archives

  • 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. 🙁

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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;

    Thanks! I will try this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_title in author archives’ is closed to new replies.