Forums

How to put author information ($curauth) into sidebar? (2 posts)

  1. porkcharsui
    Member
    Posted 3 years ago #

    I have read and understood http://codex.wordpress.org/Author_Templates

    All I want to do is put some information about the author on top of sidebar.php when a single entry is shown

    Setting up a page for authors is not a problem (using $curauth).
    However... how can I display this author information in the sidebar?

    Putting this in sidebar.php doesn't work:

    <?php if (is_single()) : ?>

    <h3>About the author</h3>
    <p><?php echo $curauth->display_name; ?> wrote this</p>

    <?php endif; ?>

    As shown in The Codex, I called this before (still in sidebar.php):

    <?php if(get_query_var('author_name')) : $curauth = get_userdatabylogin(get_query_var('author_name')); else : $curauth = get_userdata(get_query_var('author')); endif; ?>

    Putting this into header.php doesn't work either.

    Any help?

  2. jtpratt
    Member
    Posted 2 years ago #

    $curauth only works on author page, not in other places. You can only get author details in the sidebar that would work in single.php - read this tutorial: http://blog.themeforest.net/wordpress/wordpress-author-details/

Topic Closed

This topic has been closed to new replies.

About this Topic