<?php global $paged;
if(empty($paged)) $paged = 1;
?>
<?php get_header()?>

<?php if( get_theme_mod( 'kktfwp_blog_sidebar' ) === 'left') {
		$position = 'left';
		$content_position = 'right';
	} else if ( get_theme_mod( 'kktfwp_blog_sidebar' ) === 'right') {
		$position = 'right';
		$content_position = 'left';
	} else {
		$position = 'full';
		$content_position = 'none';
 };
?>
 
<?php $title_type = kktfwp_title_type(); ?>

<!-- start content wrapper -->
<div class="content">

	<?php if( !is_front_page() & $title_type == 'parallax' ) : ?>
		<div id="kk-parallax-wrapper" class="kk-parallax-wrapper">
		
			<?php echo kktfwp_parallax(); ?>
		
			<div id="kk-parallax-title-wrapper" class="kk-parallax-title-wrapper">
				<div id="kk-parallax-title" class="page-title">					
					<div id="kk-parallax-title" class="page-title">
						<?php $source = rwmb_meta( 'kk_customTitle', false, kktfwp_postid() );						
						if ( $source ) : ?>						
							<?php echo wp_kses( rwmb_meta( 'kk_customdescription', false, kktfwp_postid()), kktfwp_kses_allowed_args()) ?>						
						<?php else: ?>					
							<h1><?php echo get_the_title(get_option( 'page_for_posts' )); ?></h1>					
						<?php endif; ?>
					</div>
				</div>
			</div>
			
			<a id="kk-down" class="kk-down is-loading" href="#kk-to-me"></a>
			
		</div>
	<?php endif; ?>

	
	<div class="content-inner-wrapper clearfix">
		<span id="kk-to-me"></span>		
		<?php if( !is_front_page() & $title_type == 'default' ) { ?>
				<div class="page-title">
					<h1><?php echo get_the_title(get_option( 'page_for_posts' )); ?></h1>
				</div>	

				<div class="divider clear"></div>	
		<?php } ?>
		
		<div class="inner-content" id="<?php echo esc_attr($content_position) ?>">
	
			<!--start loop -->
			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

			<?php 
				$format = get_post_format();
				if( false === $format ) { $format = 'standard'; }
				
				get_template_part( 'formats/blog-classic/' . $format );
			?>
				
			<?php endwhile;endif; ?>
			<!--end loop -->
			
			<?php kktfwp_page_pagination(); ?>
		</div>
		
		<!-- start widgets -->
		<?php if ( get_theme_mod( 'kktfwp_blog_sidebar' ) !== '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 get_footer()?>