I am trying to set up a bit of code to show the latest post excerpt from a particular category. I want the post thumbnail to display if it is present in that post, and if not I want a default image to show. I am using this:
Code:
<?php global $post;
$myposts = get_posts('numberposts=1&category=8');
foreach($myposts as $post) :
?>
<a href="<?php the_permalink(); ?>">
<?php if (has_post_thumbnail()) the_post_thumbnail( array(100,100) ); else echo '<img class="social" src="default.jpg" alt="No Thumbnail" title="No Thumbnail" />';
?><br>
<?php the_title(); ?></a>
<?php endforeach; ?>








Linear Mode
