how to edit this condition in order to count only the posts with thumbnails?
if ( $my_query->have_posts() && ( ( $my_query->post_count ) >= 3 ) )
how to edit this condition in order to count only the posts with thumbnails?
if ( $my_query->have_posts() && ( ( $my_query->post_count ) >= 3 ) )
You have to check it in a different way;
$post_with_thumbs = 0;
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ): $my_query->the_post();
if ( has_post_thumbnail()) {
$post_with_thumbs++;
}
endwhile;
}
wp_reset_query();
if ($post_with_thumbs >= 3) {
//do stuff
}