Currently I have the following loop:
<?php
$shows_sales = get_posts(array(
'post_type' => 'show_sale',
'post_status' => 'publish',
'posts_per_page' => 3,
));
$done_image = false;
?>
<ul>
<?php foreach ($shows_sales as $post) : setup_postdata($post) ?>
<?php if (!$done_image && (has_post_thumbnail())) : ?>
<li class="active">
<a href="<?php the_permalink() ?>"><?php the_post_thumbnail('homepage'); ?></a>
<?php $done_image = true; ?>
</li>
<?php else : ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<?php wp_reset_query(); ?>
</ul>
It will show one 'active' list item if post contains featured image, others just show the title in a normal list item.
What I need to add is a check that if none of the posts have a feature image, then insert a list item at the top of the unordered list.
I'm can't get my head around how to say 'if none have post thumbnail then show this else do the above'
Any help would be greatly appreciated!