WordPress.org

Ready to get started?Download WordPress

Forums

Author name in Page Title on Author Page (3 posts)

  1. stats101
    Member
    Posted 6 years ago #

    I currently have it set as follows:

    <?php if ( is_author() ) { ?><? bloginfo('name'); ?>&nbsp;|&nbsp;Author Page<?php } ?>

    But I would like to have it set up so it has the authors name in the browser title rather than a generic one.

    The wordpress codex page:

    http://codex.wordpress.org/Conditional_Tags

    only shows how to pass in hardcoded values to generate this. Is there any way to do it dynamically?

  2. stats101
    Member
    Posted 5 years ago #

    anyone?

  3. Jelo
    Member
    Posted 5 years ago #

    Referring to the code of function is_author in /wp-includes/query.php I would suggest something like this:

    <?php
      if ( is_author() ) {
        $author_obj = $wp_query->get_queried_object();
    ?><? bloginfo('name'); ?>&nbsp;|&nbsp;Articles by <?php
        echo $author_obj->nickname;
      } ?>

    As I did this from within a callback function I had to
    global $wp_query;
    as is also done in is_author().

Topic Closed

This topic has been closed to new replies.

About this Topic