The query below runs a featured carousel on my site. I want the carousel to only display post that contain an image. I’ve searched everywhere and cannot find a solution. Please help!
query_posts(array('post_type' => 'ad_listing', 'post_status' => 'publish', 'orderby' => 'rand'));
I ran into this same thing while developing my own theme.
This is how I solved it.
Start by adding the featured image capability in your functions.php.
This allows you to select a featured image for each post.
With the featured image function available you can use the following function to detect if a post has a featured image…in loop form:
Hope this helps.