RobotDan
Member
Posted 7 years ago #
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 ( http://guff.szub.net/get-author-profile ), 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!
http://www.alittlepoison.com/archives/2006/01/05/8-bits/
Found a solution (maybe).
Insert this into the loop:
<?php
global $authordata;
$postauthorx = $authordata->ID;
?>
And this into that box:
<?php
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...
RobotDan
Member
Posted 7 years ago #
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.
RobotDan
Member
Posted 7 years ago #
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:
http://wordpress.org/support/topic/51469
...but in WordPress 2.0 it doesn't return the nickname if it has more than one word.