Simpler than using the $wpdb
class would be to use count_user_posts()
. For instance:
$min_posts = 2;
if( count_user_posts( $post->post_author ) >= $min_posts ) {
// display the user's posts
}
This assumes you’re in The Loop, or at the very least that $post
is a WordPress Post object.
[above edited 2013-03-19 11:30 AM CDT]
Note that if you’re trying to count custom post types (and possibly pages, though I’m not sure), you’ll need to use some $wpdb
magic, but there’s a code sample available at the Codex page for count_user_posts()
(linked above).