<?php
/**
 * The template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages and that
 * other 'pages' on your WordPress site will use a different template.
 *
 * @package Krown
 * @subpackage Krown
 * @since Krown 1.0
 */
?>
<?php get_template_part( 'single', 'header' ); ?>
<?php get_template_part( 'top', 'menu' );?>

<!-- Deafult Page Layout 3 -->
<?php
    global $tlazya_krwn;
    switch($tlazya_krwn['default_layout']) {
    case "3":
?>    

<section id="blog" class="blog-single section">
	<div class="container">

		<div class="page-title">
			<h2><?php echo get_bloginfo('name'); ?> <span class="color">/</span> 
			<?php
				while ( have_posts() ) : the_post();
			?>
			<?php echo get_the_title();?>
			<?php endwhile; ?>
			</h2>
		</div>


		<div class="row">
			<div class="col-md-12">
				<?php
					while ( have_posts() ) : the_post();
				?>
				<?php
				if(has_post_thumbnail( get_the_ID() ))
				{
				?>
					<div class="blog-Image">
							<?php echo get_the_post_thumbnail(get_the_ID(), 'fullpage_thumb'); ?>
					</div>
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
				<?php
				}
				else
				{
				?>
				
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
					
				<?php
				}
				?>
				
				<!-- Page Title Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 1 ) { 
				?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 0 ) 
				{
				?>
				<div style="margin-top: 20px;"></div>
				<!-- Empty -->
				<?php } else { ?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php } ?>
				
				<!-- Page Date Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 1 ) { 
				?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php } ?>
				<!-- .blog-content -->
				<div class="blog-content">
					<?php
						the_content();
						wp_link_pages( array(
							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'krown' ) . '</span>',
							'after'       => '</div>',
							'link_before' => '<span>',
							'link_after'  => '</span>',
						) );

						edit_post_link( __( 'Edit', 'krown' ), '<span class="edit-link">', '</span>' );
					?>
				</div>
				<!-- / .blog-content -->
				
				<!-- Page Comment Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['comment_switch']) && $tlazya_krwn['comment_switch'] == 1 ) { 
				?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php 
				} 
				elseif (isset($tlazya_krwn['comment_switch']) && $tlazya_krwn['comment_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php } ?>
				
				<?php
					endwhile;
				?>
			</div>
		</div>
	</div>
</section>
<div class="white-space-100"></div>


<!-- ./Single Page Layout 3 -->

<!-- Single Page Layout 2 -->
<?php break; case "2": ?>

<section id="blog" class="blog-single section">
	<div class="container">

		<div class="page-title">
			<h2><?php echo get_bloginfo('name'); ?> <span class="color">/</span> 
			<?php
				while ( have_posts() ) : the_post();
			?>
			<?php echo get_the_title();?>
			<?php endwhile; ?>
			</h2>
		</div>


		<div class="row">
			<div class="col-md-3">
				<!-- sidebar -->
				<div class="sidebar">
					<?php dynamic_sidebar('main-sidebar'); ?>
				</div>
				<!-- / .sidebar -->
			</div>
			<div class="col-md-9">
				<?php
					while ( have_posts() ) : the_post();
				?>
				<?php
				if(has_post_thumbnail( get_the_ID() ))
				{
				?>
					<div class="blog-Image">
							<?php echo get_the_post_thumbnail(get_the_ID(), 'fullpage_thumb'); ?>
					</div>
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
				<?php
				}
				else
				{
				?>
				
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
					
				<?php
				}
				?>
				
				<!-- Page Title Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 1 ) { 
				?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 0 ) 
				{
				?>
				<div style="margin-top: 20px;"></div>
				<!-- Empty -->
				<?php } else { ?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php } ?>
				
				<!-- Page Date Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 1 ) { 
				?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php } ?>
				<!-- .blog-content -->
				<div class="blog-content">
					<?php
						the_content();
						wp_link_pages( array(
							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'krown' ) . '</span>',
							'after'       => '</div>',
							'link_before' => '<span>',
							'link_after'  => '</span>',
						) );

						edit_post_link( __( 'Edit', 'krown' ), '<span class="edit-link">', '</span>' );
					?>
				</div>
				<!-- / .blog-content -->
				
				<!-- Page Comment Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['comment_switch']) && $tlazya_krwn['comment_switch'] == 1 ) { 
				?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php } ?>
				
				<?php
					endwhile;
				?>
			</div>
		</div>
	</div>
</section>
<div class="white-space-100"></div>

<!-- ./Single Page Layout 2 -->

<!-- Single Page Layout 1 -->
<?php break; case "1": ?> 

<section id="blog" class="blog-single section">
	<div class="container">

		<div class="page-title">
			<h2><?php echo get_bloginfo('name'); ?> <span class="color">/</span> 
			<?php
				while ( have_posts() ) : the_post();
			?>
			<?php echo get_the_title();?>
			<?php endwhile; ?>
			</h2>
		</div>


		<div class="row">
			<div class="col-md-9">
				<?php
					while ( have_posts() ) : the_post();
				?>
				<?php
				if(has_post_thumbnail( get_the_ID() ))
				{
				?>
					<div class="blog-Image">
							<?php echo get_the_post_thumbnail(get_the_ID(), 'fullpage_thumb'); ?>
					</div>
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
				<?php
				}
				else
				{
				?>
				
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
					
				<?php
				}
				?>
				
				<!-- Page Title Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 1 ) { 
				?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 0 ) 
				{
				?>
				<div style="margin-top: 20px;"></div>
				<!-- Empty -->
				<?php } else { ?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php } ?>
				
				<!-- Page Date Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 1 ) { 
				?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php } ?>
				<!-- .blog-content -->
				<div class="blog-content">
					<?php
						the_content();
						wp_link_pages( array(
							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'krown' ) . '</span>',
							'after'       => '</div>',
							'link_before' => '<span>',
							'link_after'  => '</span>',
						) );

						edit_post_link( __( 'Edit', 'krown' ), '<span class="edit-link">', '</span>' );
					?>
				</div>
				<!-- / .blog-content -->
				
				<!-- Page Comment Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['comment_switch']) && $tlazya_krwn['comment_switch'] == 1 ) { 
				?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php } ?>
				
				<?php
					endwhile;
				?>
			</div>
			<div class="col-md-3">
				<!-- sidebar -->
				<div class="sidebar">
					<?php dynamic_sidebar('main-sidebar'); ?>
				</div>
				<!-- / .sidebar -->
			</div>
		</div>
	</div>
</section>
<div class="white-space-100"></div>

<!-- ./Single Page Layout 1 -->

<!-- Single Page Layout Default -->
<?php break; default: ?> 

<section id="blog" class="blog-single section">
	<div class="container">

		<div class="page-title">
			<h2><?php echo get_bloginfo('name'); ?> <span class="color">/</span> 
			<?php
				while ( have_posts() ) : the_post();
			?>
			<?php echo get_the_title();?>
			<?php endwhile; ?>
			</h2>
		</div>


		<div class="row">
			<div class="col-md-12">
				<?php
					while ( have_posts() ) : the_post();
				?>
				<?php
				if(has_post_thumbnail( get_the_ID() ))
				{
				?>
					<div class="blog-Image">
							<?php echo get_the_post_thumbnail(get_the_ID(), 'fullpage_thumb'); ?>
					</div>
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
				<?php
				}
				else
				{
				?>
				
					<?php 	
					global $tlazya_krwn; 
					if (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 1 ) { 
					?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php 
					} 
					elseif (isset($tlazya_krwn['author_switch']) && $tlazya_krwn['author_switch'] == 0 ) 
					{
					?>
					<!-- Empty -->
					<div style="margin-top: 20px;"></div>
					<?php } else { ?>
					<div class="blog-author">
						<div class="Image" style="margin-top: 0px;"><?php echo get_avatar( $comment, '' ); ?></div>
						<p>by <?php echo get_the_author(); ?></p>
					</div>
					<?php } ?>
					
				<?php
				}
				?>
				
				<!-- Page Title Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 1 ) { 
				?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['title_switch']) && $tlazya_krwn['title_switch'] == 0 ) 
				{
				?>
				<div style="margin-top: 20px;"></div>
				<!-- Empty -->
				<?php } else { ?>
				<div class="blog-title text-center">
					<h2><?php echo get_the_title();?></h2>
				</div>
				<?php } ?>
				
				<!-- Page Date Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 1 ) { 
				?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<div class="default-blog-info">
					Date: <?php echo get_the_time('F'); ?> <?php echo get_the_time('j'); ?> <?php echo get_the_time('Y'); ?>
				</div>
				<?php } ?>
				<!-- .blog-content -->
				<div class="blog-content">
					<?php
						the_content();
						wp_link_pages( array(
							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'krown' ) . '</span>',
							'after'       => '</div>',
							'link_before' => '<span>',
							'link_after'  => '</span>',
						) );

						edit_post_link( __( 'Edit', 'krown' ), '<span class="edit-link">', '</span>' );
					?>
				</div>
				<!-- / .blog-content -->
				
				<!-- Page Comment Show/Hide -->
				
				<?php 	
				global $tlazya_krwn; 
				if (isset($tlazya_krwn['comment_switch']) && $tlazya_krwn['comment_switch'] == 1 ) { 
				?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php 
				} 
				elseif (isset($tlazya_krwn['date_switch']) && $tlazya_krwn['date_switch'] == 0 ) 
				{
				?>
				<!-- Empty -->
				<?php } else { ?>
				<!-- .blog-comments -->
				<div class="blog-comments">
					<!-- .comments -->
					<?php
						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
					?>
					<!-- / .comments -->
				</div>
				<!-- / .blog-comments -->
				<?php } ?>
				
				<?php
					endwhile;
				?>
			</div>
		</div>
	</div>
</section>
<div class="white-space-100"></div>
<?php } ?>
<?php
get_footer();