<?php 
/**
 * Titan header posts
**/ 
?>
<?php
function header_posts(){
	$t1t_header_posts_tags = get_option('t1t_header_posts_tags');
	$t1t_header_size = get_option('t1t_header_size');
	if($t1t_header_size == 'normal'){$post_number = '2';}elseif($t1t_header_size == 'fullwidth'){$post_number = '3';}
	
	?>
	<div class="header-posts">	
			<ul>
				<?php $t1t_posts = new WP_Query(array( 'tag' => $t1t_header_posts_tags, 'posts_per_page' => $post_number )); while ( $t1t_posts->have_posts()) : $t1t_posts->the_post(); ?>
				<li>
					<div class="featured-posts-image">
						<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
						<?php the_post_thumbnail('small-thumb'); ?>
						</a>
						<?php } ?>
					</div>
					<!---featured-posts-image-->
					<div class="featured-posts-text">
						<span class="category-icon">
						<?php $category = get_the_category(); if($category[0]){echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';} ?>
						</span>
						<div class="featured-posts-title">
							<a href="<?php the_permalink() ?>">
							<?php echo wp_trim_words( get_the_title(), 10 ); ?>
							</a>
						</div>
						<!--featured-posts-title-->
						<div class="date">
						<?php echo get_the_date(); ?>
						</div>
						
					</div>
					<!--featured-posts-text-->
				</li>
				<?php endwhile; ?>
			</ul>
		</div>
		<!--header-posts-->	
<?php }; ?>