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

  1. stats101
    Posted 7 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:


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

  2. stats101
    Posted 7 years ago #


  3. Jelo
    Posted 7 years ago #

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

      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