Martin Black
Member
Posted 8 months ago #
Is there a way to use query_posts to collect only posts which have had a featured image set? (i.e. the "set featured image" has been done through the admin panel when posting the items).
I am in the process of creating a random posts showing only thumbnails so this would be quite handy to be able to exclude post which don't have a featured image.
Thanks.
Martin Black
Member
Posted 8 months ago #
I believe that this requires a join between wp_posts table and the wp_postmeta table wherein lies _wp_attached_file though I'm not sure if this correct. Or how to do it. Any help would be appreciated.
Thanks
TheDoc
Member
Posted 8 months ago #
I have a feeling you could do something like this:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
if(has_post_thumbnail()) {
the_content();
the_post_thumbnail();
}
endwhile; ?>
Martin Black
Member
Posted 8 months ago #