logo

This is an old version of this answer!

Return to the current answer
This might do the trick.

<h3>List categories</h3>

<?php

$categories = get_categories('exclude=28');
foreach($categories as $cat){
echo '<li>';
echo '<h4>'.$cat->cat_name.'</h4>';

$catId = get_cat_id($cat->cat_name);

$catPost = get_posts('numberposts=1&category='.$catId);

setup_postdata($catPost[0]); ?>


<a href="<?php the_permalink(); ?>"><img style="float:left; margin:0px 18px 18px 0px;" src="/wp-content/themes/portfolio/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "image", true); ?>&h=225&w=225&zc=1&q=100" alt="<?php the_title(); ?> by Andrew Areoff" /></a>

<?php echo '<li>';
}

?>


I can't test it, I don't have timthumb at hand now, but it should work.

Dan Fraticiu | 02/03/10 at 5:27am

This is an old version of this answer!

Return to the current answer