Welcome to WebmasterWorld Guest from 54.198.15.59

Forum Moderators: ergophobe

Message Too Old, No Replies

WP Display Posts From User

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

Junior Member

5+ Year Member

joined:Sept 11, 2008
posts: 180
votes: 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.

6:08 pm on June 22, 2009 (gmt 0)

Moderator This Forum

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
posts:8298
votes: 142


Would this help?
[codex.wordpress.org...]
6:23 pm on June 22, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 11, 2008
posts:180
votes: 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!

6:46 pm on June 22, 2009 (gmt 0)

Moderator This Forum

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
posts:8298
votes: 142


Good job and thanks for posting the code!