Here is something i have used recently… not too complicated…
First.. we call all categories.
Then.. we get posts inside each category using foreach
<?php
$allcats = get_categories('child_of=".get_query_var("cat'));
foreach ($allcats as $cat) :
$args = array(
'posts_per_page' => 3, // max number of post per category
'category__in' => array($cat->term_id)
);
$customInCatQuery = new WP_Query($args);
if ($customInCatQuery->have_posts()) :
echo '<div>';
echo '<h3>'.$cat->name.'</h3>';
echo '<ul>';
while ($customInCatQuery->have_posts()) : $customInCatQuery->the_post(); ?>
<li><a href="https://wordpress.stackexchange.com/questions/66508/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
echo '</ul></div>';
?>
<?php else :
echo 'No post published in:'.$cat->name;
endif;
wp_reset_query();
endforeach;
?>
Hope this helps…
Have a gr8 day, Sagive.