A recent commission to design a website for Helford River Sailing Club required recent posts from three separate categories to be shown on the site’s front page with thumbnails and excerpts under their individual category names. ¬†Eventually Google yielded the component parts of the following piece of code:

<?php
global $post;
$myposts = get_posts('numberposts=10&offset=0&category=17,18,19');
foreach($myposts as $post) :
setup_postdata($post);
foreach((get_the_category()) as $category) 
{ echo $category->cat_name . ' '; }
?>
<li class="cat-post-item">
<a class="post-title" href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a><br />
<a href="<?php the_permalink(); ?>" 
title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?></a>
<?php the_excerpt(); ?></li>
<?php endforeach; ?>