<?php 
/**
 * Trending news ticker
**/ 
?>
<?php
function ticker() {?>
<div class="ticker">
	<ul class="slides">
		<?php $tn_posts = new WP_Query(array( 'tag' => get_option('tn_ticker_tags'), 'posts_per_page' => get_option('tn_ticker_number') )); while($tn_posts->have_posts()) : $tn_posts->the_post();?>

		<li>
			<div class="ticker-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><!--ticker-image-->
			<div class="ticker-posts-text">
            	<div class="ticker-cat"><?php $category = get_the_category(); if($category[0]){echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';} ?></div>
				<h2><a href="<?php the_permalink() ?>" class="small-featured-posts-title">
					<?php the_title(); ?>
					</a></h2>
				<div class="ticker-date-posted">
					<div class="post-date">
						<span class="date"><?php echo get_the_date(); ?></span>
					</div><!--post-date-->
				</div><!--ticker-date-posted--> 
			</div><!--ticker-posts-text--> 
		</li>

		<?php endwhile; ?>
	</ul>
</div><!--ticker-->
<div class="ticker-nav">
        <a href="#" class="tick-prev" ></a>
        <a href="#" class="tick-next"></a>
</div><!--ticker-nav-->

<?php }; ?>