Forum Moderators: coopster
<?php
$numposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_author = 1");
echo "Posts by .....";
foreach ($numposts as $numpost) {
echo "<ul><li>".$numpost->post_title."</li></ul>";
}
?>
Instead of showing the posts of author 1 I would like to show the posts of whoever is currently logged on.
I have this other bit of code which shows how to find out the id of the current user:
<a href="http://mysite.com/?author='. wp_get_current_user()->ID . '">Category</a>
I tried replacing the 1 in the first statement with
'. wp_get_current_user()->ID . '
But that just gave me an error.
Any ideas how I can fix this?
Thanks.