<?php get_header(); ?>
			
			<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

			<!--BEGIN #primary .hfeed-->
			<div id="primary" class="hfeed">
				
				<h1 class="page-title"><?php echo $term->name ?></h1>
				
				<?php
				
				$caption = $term->description;
				
				if($caption != '') : 
				
				?>
				<p class="page-caption"><?php echo stripslashes(htmlspecialchars_decode(nl2br($caption))); ?></p>
				<?php endif; ?>
				
				<div class="grid clearfix">
				
					<?php 
					$count = 1;
					$paged = (get_query_var('paged')) ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1 );
					query_posts(array(
							'paged' => $paged,
							'post_type' => 'portfolio',
							'skill-type' => $term->slug,
							'posts_per_page' => -1
						)
					);
					$post_count = $wp_query->post_count;
					if (have_posts()) : while (have_posts()) : the_post(); 
					$terms = get_the_terms( get_the_ID(), 'skill-type' );
					
					?>
					
					<!--BEGIN .hentry -->
					<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
						
						<!--BEGIN .post-wrap -->
						<div class="post-wrap <?php if($count&1 && $post_count != $count) : echo "odd"; endif; ?>">
	
							<?php 
		                    
							$thumb = get_post_meta(get_the_ID(), 'tz_portfolio_thumb', TRUE); 
						
							if($thumb == '')
								$thumb = FALSE;
		                    
		                    ?>
		                    <div class="post-thumb clearfix">
		                    	
	                            <a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">
	                            	<span class="post-thumb-overlay"></span>
	                            	<?php if($thumb) : ?>
	                                <img width="290" height="150" src="<?php echo $thumb; ?>" alt="<?php the_title(); ?>" />
	                            	<?php else: ?>
	                            	<?php the_post_thumbnail('thumbnail-home'); ?>
	                            	<?php endif; ?>
	                            </a>
                    
		                    </div>
		                    
		                    <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
		                    
		                    <?php if($terms) : ?>
		                    <!--BEGIN .entry-meta .entry-footer-->
							<div class="entry-meta entry-footer">
								<span class="entry-categories">
									<?php foreach ($terms as $term) :  ?>
				                    <a href="<?php echo get_term_link($term->slug, 'skill-type'); ?>"><?php echo $term->name; ?></a><span>, </span>
				                    <?php endforeach; ?>
								</span>
							<!--END .entry-meta .entry-footer-->
							</div>
							<?php endif; ?>

						<!--END .post-wrap -->
						</div>
						
							        
	                <!--END .hentry-->  
					</div>
					
					<?php $count++; endwhile; endif; ?>

				</div>
				
			<!--END #primary .hfeed-->
			</div>
				

<?php get_sidebar(); ?>

<?php get_footer(); ?>