Support » Fixing WordPress » Using author template tags *outside* of The Loop!

  • I want to have information of the author within the sidebar (sidebar.php). Unfortunately the template tags to retrieve this information must be within the loop (e.g. the_author, the_author_description)

    Can I store these while in The Loop within a php variable and then return in the sidebar? Or can you think of another way I may achieve this?

    Previously I achieved this by using the Get Author Profile plugin ( ), which has now stopped working after the upgrade to WordPress 2.0. The empty box on the right is where I want the info to go!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Found a solution (maybe).

    Insert this into the loop:

    global $authordata;
    $postauthorx = $authordata->ID;

    And this into that box:

    global $postauthorx;
    echo $postauthorx;
    $result = @mysql_query("SELECT meta_value FROM wp_usermeta WHERE user_id = $postauthorx AND meta_key = 'description'");
    while ($row = mysql_fetch_array($result)) {

    $description = $row["meta_value"];
    echo $description;
    } ?>

    But maybe there’s an easier way…

    Thanks a lot for your help, it works! Shame I don’t know enough php to see why the Get Author Profile plugin no longer works.

    I’ve used the above method to show the author info on a single article page, and now I’m trying to get it to show when you are viewing an author archive.

    I’ve tried the method here:

    …but in WordPress 2.0 it doesn’t return the nickname if it has more than one word.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using author template tags *outside* of The Loop!’ is closed to new replies.