homepage Welcome to WebmasterWorld Guest from 54.198.130.203
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

    
WP Display Posts From User
almo136




msg:3936443
 2:14 am on Jun 19, 2009 (gmt 0)

Hi,

Does anyone know what code I could add to my sidebar.php to display the posts of the currently logged in user?

Thanks.

 

ergophobe




msg:3938354
 6:08 pm on Jun 22, 2009 (gmt 0)

Would this help?
[codex.wordpress.org...]

almo136




msg:3938361
 6:23 pm on Jun 22, 2009 (gmt 0)

Figured it out:

<?php if (is_user_logged_in() ) {
foreach ($numposts as $numpost) {
if($numpost->post_author == wp_get_current_user()->ID) {
echo "<ul><li><a href='".get_page_link($numpost->ID)."'>".$numpost->post_title."</a></li></ul>";
}
}
}
else {
echo '';
}
?>

Thanks!

ergophobe




msg:3938370
 6:46 pm on Jun 22, 2009 (gmt 0)

Good job and thanks for posting the code!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved