<?php 
/**
 * Trending news author
**/ 
?>
<?php get_header(); ?>

<div id="main">
	<div id="primary">
		<?php 
$tnauthorbox = get_option('tn_author_box'); if ($tnauthorbox == "true") { ?>
		<?php $curauth = ( isset( $_GET['author_name'] ) ) ? get_user_by( 'slug', $author_name ) : get_userdata( intval( $author ) ); ?>
		<div id="author-info">
			<div id="author-image">
				<?php echo get_avatar( $curauth->ID, '96' ); ?>
			</div><!--author-image-->
			<div id="author-desc">
				<h2><?php echo $curauth->display_name; ?></h2>
				<?php echo $curauth->description; ?>
			</div><!--author-desc-->
			<ul class="author-social">
				<?php if($curauth->facebook) { ?>
				<li> <a href="http://facebook.com/<?php echo $curauth->facebook; ?>" class="fb-social-icon"></a> </li>
				<?php } ?>
				<?php if($curauth->twitter) { ?>
				<li> <a href="https://twitter.com/<?php echo $curauth->twitter; ?>" class="twitter-social-icon"></a> </li>
				<?php } ?>
				<?php if($curauth->google) { ?>
				<li> <a href="http://plus.google.com/<?php echo $curauth->google; ?>?rel=author" class="google-social-icon"></a> </li>
				<?php } ?>
				<?php if($curauth->pinterest) { ?>
				<li> <a href="http://www.pinterest.com/<?php echo $curauth->pinterest; ?>?rel=author" class="pinterest-social-icon"></a> </li>
				<?php } ?>
				<?php if($curauth->linkedin) { ?>
				<li> <a href="http://www.linkedin.com/company/<?php echo $curauth->linkedin; ?>?rel=author" class="linkedin-social-icon"></a> </li>
				<?php } ?>
			</ul>
		</div><!--author-info-->
		<?php } ?>
		<div class="author-posts">
			<ul class="newest-posts-author">
				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
				<li>
					<div class="newest-posts-thumb">
						<?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
						<?php the_post_thumbnail('carousel-thumb'); ?>
						</a>
						<?php } ?>
					</div><!--newest-posts-thumb-->
                    <div class="newest-posts-text">
                    <span class="category-sidebar-news"><?php $category = get_the_category(); if($category[0]){echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';} ?></span>
                        <h2><a href="<?php the_permalink() ?>" class="newest-posts-title">
                            <?php the_title(); ?>
                            </a>
                        </h2>
                        <div class="newest-posts-content">
                            <?php echo excerpt(37); ?>
                        </div><!--newest-posts-content-->
                        <div class="newest-posts-date-posted">
                            <span class="bypostauthor">
                            <?php the_author_posts_link(); ?>
                            </span>
                            <span class="date">
                            <?php echo get_the_date(); ?>
                            </span>
                            <span class="views-count">
                                <?php echo get_views(get_the_ID()); ?>
                            </span>
                            <span class="comments-count">
                                <?php comments_number( '0', '1', '%' ); ?>
                            </span>
                        </div><!--newset-posts-date-posted-->
                    </div><!--newest-posts-text-->
				</li>
				<?php endwhile; endif; ?>
			</ul>
		</div><!--author-posts-->
		<div class="pagination">
			<?php tn_pagination(); ?>
		</div><!--pagination-->
	</div><!--primary-->
	<?php get_sidebar('category'); ?>
</div><!--main-->
<?php get_footer(); ?>
