How to list wordpress posts by author
November 4, 2008 · Print This Article
You first need to know the ID of each author you want to list posts.
On your WordPress dashboard, go to Users.
When you put your mouse over an username, look for the adress appearing in your browser’s status bar. The user ID is displayed in the url.
Once you have the ID(s), paste the following code where you want to list the post from a specific author:
$numposts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_author = 1");
echo "Posts by Author 1";
<ul>
foreach ($numposts as $numpost) {
echo "<li>".$numpost->post_title."</li>";
}
</ul>
To list posts from a second author, simply repeat the above code and change the post_author in the query.




















[...] Anlat