<?php if (has_post_thumbnail()||is_search()) { $singleclass="singlepost"; }
else { $singleclass = "pagepost"; } ?>
<?php if (is_home()) { $singleclass=" "; } ?>
<aside id="sidebar" class="<?php echo $singleclass; ?>">
<?php query_posts( 'cat=5&showposts=2' ); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'sidebar-thumbnail', flase ); ?>
<!-- { the_post_thumbnail( ''post-thumbnail' , false' ); -->
<article id="post-<?php the_ID(); ?>" >
<div class="advert" style="background: url(<?php echo $src[0]; ?> ) top left no-repeat;">
<div class="copy">
<h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</div>
</div>
</article>
<?php endwhile; ?>
<?php else : ?>
<section id="no-results">
<h2>Oh no, there’s nothing here.</h2>
<p>Maybe a search will find what you’re looking for.</p>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</section>
<?php endif; ?>
<!-- extra stuff -->
<ul id="sidebar">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar() ) : ?>
<?php endif; ?>
</ul>
</aside>