<?php
// Template Name: Blog
get_header(); ?>

			<!-- BEGIN MAIN -->
			<div id="main">
				<div class="homepage-widget">
					<div class="block full archive clearfix">
					
						<h3>
							<?php _e('Blog', 'Broadway'); ?>
							<span></span>
						</h3>

						<div class="block-content clearfix">
						<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
						<?php $blog = new WP_Query('showposts=5'.'&paged='.$paged); ?>
						<?php if ($blog->have_posts()) : while ($blog->have_posts()) : $blog->the_post(); ?>
							<div id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?>>
								<?php if(has_post_thumbnail()): ?>
								<div class="block-image">
									<div class="post-thumb-container clearfix">
										<?php
										if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
											$icon = '<span class="post-format-big ' . get_post_format($post->ID) . '"></span>';
										} else {
											$icon = '';
										}
										echo $icon;
										?>
										<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="post-thumbnail">
											<?php the_post_thumbnail('archive-image', array('alt' => get_the_title(), 'title' => get_the_title())); ?>
										</a>
										<?php if(get_post_meta($post->ID, 'pyre_overall_score', true)): ?>
										<div class="post-score"><img src="<?php bloginfo('template_directory'); ?>/images/stars/<?php echo get_post_meta($post->ID, 'pyre_overall_score', true); ?>.png" alt="" /></div>
										<?php endif; ?>
									</div>
								</div>
								<?php endif; ?>
								<div class="post-content">
									<h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
									<p class="post-meta"><?php the_time('F jS, Y'); ?>, by <?php the_author_posts_link(); ?></p>
									<p class="post-excerpt"><?php echo string_limit_words(get_the_excerpt(), 16); ?> ...</p>
									<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>' class="readmore orange-button"><?php _e('Read More', 'Broadway'); ?></a>
								</div>
							</div>
						<?php endwhile; endif; ?>
						</div>
						
						<?php kriesi_pagination($blog->max_num_pages, $range = 2); ?>
					</div>
				</div>
			</div>
			<!-- END MAIN -->
			
<?php get_sidebar(); ?>
			
<?php get_footer(); ?>