I'm doing an archive page for a theme that will contain only images thumbnails. The maximum amount of thumbnails that the page layout can contains is 12. So as query I would like to been able to get two different results.
If there is 12 thumbnails, show them all.
If there is less than that maximum, fill the rest with the amount of placeholder that you need to bring the result to 12.
Here my first draft:
<?php
$count = 1;
query_posts( 'posts_per_page=12&order=ASC' );
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="archive-post-single">
<?php if ( has_post_thumbnail() ) {
?>
<a href="<?php echo get_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<?php
}
?>
</div>
<?php $count++;
endwhile; endif; ?>
<?php if ($count < 12) { ?>
<div class="archive-post-single">
<img src="<?php bloginfo('template_directory'); ?>/images/thumb.png" alt="" />
</div>
<?php } ?>
</div>
<?php wp_reset_query(); ?>