<?php get_header(); ?>
<?php magnews_setPostViews() ?>
<div class="content-wrap">
	<div class="content">
		<?php magnews_breadcrumbs() ?>
		
		<?php if ( ! have_posts() ) : ?>
		<div id="post-0" class="post not-found post-listing">
			<h1 class="post-title"><?php _e( 'Not Found', 'magnews' ); ?></h1>
			<div class="entry">
				<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'magnews' ); ?></p>
				<?php get_search_form(); ?>
			</div>
		</div>
		<?php endif; ?>

		<?php while ( have_posts() ) : the_post(); ?>
		
		<?php $get_meta = get_post_custom($post->ID);
			if( !empty( $get_meta['magnews_review_position'][0] ) ){
				$review_position = $get_meta['magnews_review_position'][0] ;
				$rv = $magnews_reviews_attr;
			}
		?>
		
		<?php //Above Post Banner
		if(  empty( $get_meta["magnews_hide_above"][0] ) ){
			if( !empty( $get_meta["magnews_banner_above"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["magnews_banner_above"][0]) .'</div>';
			else magnews_banner('banner_above' , '<div class="ads-post">' , '</div>' );
		}
		?>
				
		<article <?php if( !empty( $rv['review'] ) ) echo $rv['review']; post_class('post-listing'); ?>>
			<?php magnews_include( 'post-head' ); // Get Post Head template ?>	

			<div class="post-inner">
				<h1 class="name post-title entry-title" itemprop="name"><?php the_title(); ?></h1>
				<?php magnews_include( 'post-meta' ); // Get Post Meta template ?>	
				<div class="entry">
					<?php if( !empty( $review_position ) && ( $review_position == 'top' || $review_position == 'both'  ) ) magnews_get_review('review-top'); ?>

					<?php the_content(); ?>
					<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'magnews' ), 'after' => '</div>' ) ); ?>
					
					<?php if( !empty( $review_position ) && ( $review_position == 'bottom' || $review_position == 'both' ) ) magnews_get_review('review-bottom'); ?>

					<?php edit_post_link( __( 'Edit', 'magnews' ), '<span class="edit-link">', '</span>' ); ?>
				</div><!-- .entry /-->
				<?php the_tags( '<span style="display:none">',' ', '</span>'); ?>
				<span style="display:none" class="updated"><?php the_time( 'Y-m-d' ); ?></span>
				<div style="display:none" class="vcard author" itemprop="author" itemscope itemtype="http://schema.org/Person"><strong class="fn" itemprop="name"><?php the_author_posts_link(); ?></strong></div>
				<?php magnews_include( 'single-post-share' ); // Get Share Button template ?>	
			</div><!-- .post-inner -->
		</article><!-- .post-listing -->
		<?php if( magnews_get_option( 'post_tags' ) ) the_tags( '<p class="post-tag">'.__( 'Tagged with: ', 'magnews' )  ,' ', '</p>'); ?>

				
		<?php if( ( magnews_get_option( 'post_authorbio' ) && empty( $get_meta["magnews_hide_author"][0] ) ) || ( isset( $get_meta["magnews_hide_related"][0] ) && $get_meta["magnews_hide_author"][0] == 'no' ) ): ?>		
		<section id="author-box">
			<div class="block-head">
				<h3><span class="block-head-title"><?php _e( 'About', 'magnews' ) ?> <?php the_author() ?></span></h3>
			</div>
			<div class="post-listing">
				<?php magnews_author_box() ?>
			</div>
		</section><!-- #author-box -->
		<?php endif; ?>

	<?php //Below Post Banner
		if( empty( $get_meta["magnews_hide_below"][0] ) ){
			if( !empty( $get_meta["magnews_banner_below"][0] ) ) echo '<div class="ads-post">' .htmlspecialchars_decode($get_meta["magnews_banner_below"][0]) .'</div>';
			else magnews_banner('banner_below' , '<div class="ads-post">' , '</div>' );
		}
		?>
        
		<?php magnews_include( 'post-related' ); // Get Related Posts template ?>	

		<?php endwhile;?>

		<?php comments_template( '', true ); ?>
	
	</div><!-- .content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>