Support » Fixing WordPress » Access author data outside loop in sidebar

  • Resolved TrishaM

    (@trisham)


    Having trouble with using author meta data outside the loop (in the sidebar) of a single post page. It works perfectly in the sidebar on Author page (using template author.php) but not on a single.php

    I have this outside the loop:

    <?php
    if(isset($_GET['author_name'])) :
    $curauth = get_userdatabylogin(get_the_author_login());
    else :
    $curauth = get_userdata(intval($author));
    endif;
    ?>

    If I use that in the sidebar on author.php it works perfectly and I can access all the author meta data (e.g. $curauth->aim; )

    BUT if I use it in the sidebar on single.php to access the author meta data for the author of that particular post, it doesn’t give me the correct author data, it gives me MY data even though I am not the author of the post…..

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Access author data outside loop in sidebar’ is closed to new replies.