<?php get_header(); ?>
<?php the_post(); ?>

<?php if(get_option('toppic_theme_blog_sidebar_single') == 'left') {
		$position = 'left';
		$content_position = 'right';
	} else if (get_option('toppic_theme_blog_sidebar_single') == 'right') {
		$position = 'right';
		$content_position = 'left';
	} else if (get_option('toppic_theme_blog_sidebar_single') == 'full') {
		$position = 'full';
		$content_position = 'none';
	} else {
		$position = 'right';
		$content_position = 'left';
	}	

$kk_parallax = kk_parallax();
$title_type = $kk_parallax[0];
$bg_title_img = $kk_parallax[1];
	
?>

<?php if ( post_password_required( $post ) ) { 

		get_template_part( 'password-form' );
		
	} else { ?>
			
	<!-- start content wrapper -->			
	<div class="content">

		<?php if( $title_type == 'parallax' ) { ?>
		
		<div id="kk-parallax-wrapper" class="kk-parallax-wrapper">
			
			<div id="kk-parallax-bg" class="kk-parallax-bg kk-hidden">
				<img id="kk-img-check" src="<?php echo esc_url( $bg_title_img ) ?>" alt="<?php echo esc_attr( $kk_parallax[2] ) ?>" />
			</div>

			<div id="kk-parallax-title-wrapper" class="kk-parallax-title-wrapper">
				<div id="kk-parallax-title" class="page-title">
					<h1><?php the_title(); ?></h1>
					
					<?php get_template_part( 'formats/single-post/post-meta' ); ?>
				</div>	
			</div>	
			
			<a id="kk-down" class="kk-down is-loading" href="#kk-to-me"></a>
		
		</div>	

		<?php } ?>
		
		<div class="content-inner-wrapper clearfix">
		<span id="kk-to-me"></span>
		<?php if( $title_type == 'default' ) { ?>
		
			<div class="post-title">
				<h1><?php the_title(); ?></h1>
				
				<?php get_template_part( 'formats/single-post/post-meta' ); ?>
			</div>	

			<div class="divider clear"></div>	
			
		<?php } ?>
				
			<div class="inner-content" id="<?php echo esc_attr($content_position) ?>">
			
				<?php 
					$format = get_post_format();
					if( false === $format ) { $format = 'standard'; }
					get_template_part( 'formats/single-post/' . $format.'-single' );
				?>
				
				<?php if( $format == 'quote' ): ?>
				
				<?php $quoteLink = get_post_meta($post->ID, '_post_quote_source_value', true); ?>
			
					<h2 class="quote-text">
						&ldquo;<?php echo get_post_meta($post->ID, '_post_quote_value', true); ?>&rdquo;
					</h2>
					
					<?php if ($quoteLink!="") {?>
					<span class="quote-source">
						&mdash;&nbsp;<?php echo esc_url($quoteLink) ?>
					</span>
					<?php } ?>
				
				<?php else: ?>
				
				<div class="post-entry">
					<?php the_content(); ?>
				</div>
				
				<?php endif; ?>
				
				<?php if(has_tag()) { ?>
				<div class="post-tags">
					<h4><?php _e('Tags:','toppic'); ?></h4>
					<?php the_tags('',''); ?>
				</div>
				<?php } ?>

				<?php comments_template(); ?>
				

			</div>	
			
			<!-- start widgets -->
			<?php if (get_option('toppic_theme_blog_sidebar_single') != 'full') {
				if(is_active_sidebar("kk-blog-sidebar")) { ?> 
					<div class="sidebar" id="<?php echo esc_attr($position) ?>">
						<?php dynamic_sidebar("kk-blog-sidebar")?>		
					</div>
			<?php } } ?>
			<!-- end widgets -->
					
		</div>
		
		<?php get_template_part('extends/footer-area') ?>	
		
	</div>
	<!-- end content wrapper -->
<?php } ?>
			
<?php get_footer(); ?>