logo

This is an old version of this answer!

Return to the current answer
Final solution:

<h3>List categories</h3>
<ul>
<?php

$categories = get_categories('exclude=28');

foreach($categories as $cat){

echo '<li style="float: left;">';

$catPost = get_posts('numberposts=1&category='.$cat->cat_ID.'');

$post = $catPost[0];

setup_postdata($post);

echo '<a href="'.get_category_link( $cat->cat_ID ).'"><img style="margin:0px 18px 18px 0px; height: 225px; width: 225px; display: block;" src="/wp-content/themes/portfolio/scripts/timthumb.php?src='.get_post_meta($post->ID, "image", true).'&h=225&w=225&zc=1&q=100" alt="'.$post->title.'" /></a>';

echo '<h4><a href="'.get_category_link( $cat->cat_ID ).'">'.$cat->cat_name.'</a></h4>';

echo '</li>';

}
?>
</ul>

Dan Fraticiu | 02/04/10 at 8:20am

This is an old version of this answer!

Return to the current answer