<?php
/**
 * Page
 *
 * @package passport
 * @subpackage passport
 * @since Passport v.1.0.
 * 
**/
    get_header(); 
 
    global $passport_page_content_column;
	global $passport_page_sidebar_position;
	global $passport_page_sidebar_width;

	$passport_page_content_column	    = get_theme_mod( 'passport_page_main_content', 'main_content' );
	$passport_page_sidebar_position	    = get_theme_mod( 'passport_page_sidebar_position', 'left' );
	$passport_page_sidebar_width		= get_theme_mod( 'passport_page_sidebar_width', 'sidebar_25' );
	
    $frontpage_id  = get_option( 'page_on_front' );
	$attachment_id = get_post_thumbnail_id( $frontpage_id ); 
 ?>

<?php if( have_posts() ) : ?>
	<?php while ( have_posts() ) : the_post(); ?>
		<div id="primary" class="container">
			<div id="wrapper" class="content-column fix-width clearfix">
				<?php
					if( 'main_content' == $passport_page_content_column ) : ?>
					<!-- Beginning of full width -->
					<div id="content" class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
						<div class="row">
							<div class="page-item">
								<article id="page-<?php the_ID(); ?>">
									<div class="center-image clearfix">
										<?php 
											get_template_part( 'partials/partials', 'image' ); 
										 ?>
									</div><!-- image -->
									<div class="page-content">
										<?php	  
											get_template_part( 'partials/partials', 'header' ); 
											get_template_part( 'partials/partials', 'content' ); 
										?>
									</div>
								</article><!--page -->
							</div>
							<?php wp_link_pages($defaults); ?>
							<?php comments_template( '/comments.php' ); ?>
						</div>
					</div><!-- #content -->
					<!-- End of full width -->
					<?php elseif( 'sidebar' == $passport_page_content_column )  : ?>
						<?php if( 'right' == $passport_page_sidebar_position ) : ?>						
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								<div id="content" class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width ) : ?>
								<div id="content" class="col-md-8 col-lg-8">
							<?php endif; ?><!--End of sidebar width loop -->
									<div class="row">
										<div class="<?php if( has_post_thumbnail() || 0 != $attachment_id ) { echo 'has-thumbnail'; } else { echo 'no-thumbnail'; } ?> page-item">
										<article id="page-<?php the_ID(); ?>">
											<div class="center-image clearfix">
												<?php 
													get_template_part( 'partials/partials', 'image' ); 
												 ?>
											</div><!-- image -->
											<div class="page-content">
												<?php	  
													get_template_part( 'partials/partials', 'header' ); 
													get_template_part( 'partials/partials', 'content' ); 
												?>
											</div>
										</article>
									</div>
										<?php wp_link_pages($defaults); ?>
										<?php comments_template( '/comments.php' ); ?>
									</div>
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								</div><!-- #content -->
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width ) : ?>
								</div><!-- #content -->
							<?php endif; ?><!--End of sidebar width loop -->
								
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								<div id="sidebar" class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								<div id="sidebar" class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
							<?php endif; ?><!--End of sidebar width loop -->
									<div class="row">
										<div class="right-sidebar">
											<?php get_sidebar(); ?>
										</div>
									</div>
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								</div><!-- #sidebar -->
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								</div><!-- #sidebar -->
							<?php endif; ?><!--End of sidebar width loop -->
					
						<?php endif; ?><!-- End of Right Sidebar -->

						<?php if ( 'left' == $passport_page_sidebar_position ) : ?>
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								<div id="sidebar" class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								<div id="sidebar" class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
							<?php endif; ?><!--End of sidebar width loop -->
									<div class="row">
										<div class="left-sidebar">
											<?php get_sidebar(); ?>
										</div>
									</div>
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								</div><!-- #sidebar -->
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								</div><!-- #sidebar -->
							<?php endif; ?><!--End of sidebar width loop -->

							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								<div id="content" class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								<div id="content" class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
							<?php endif; ?><!--End of sidebar width loop -->
									<div class="row">
										<div class="<?php if( has_post_thumbnail() || 0 != $attachment_id ) { echo 'has-thumbnail'; } else { echo 'no-thumbnail'; } ?> page-item">
										<article id="page-<?php the_ID(); ?>">
											<div class="center-image clearfix">
												<?php 
													get_template_part( 'partials/partials', 'image' ); 
												 ?>
											</div><!-- image -->
											<div class="page-content">
												<?php	  
													get_template_part( 'partials/partials', 'header' ); 
													get_template_part( 'partials/partials', 'content' ); 
												?>
											</div>
										</article><!--page -->
											</div>
										<?php wp_link_pages($defaults); ?>
										<?php comments_template( '/comments.php' ); ?>
									</div>
							<?php if( 'sidebar_25' == $passport_page_sidebar_width ) : ?>
								</div><!-- #content -->
							<?php elseif( 'sidebar_33' == $passport_page_sidebar_width) : ?>
								</div><!-- #content -->
							<?php endif; ?><!--End of sidebar width loop -->

						<?php endif; ?><!-- End of Left Sidebar -->
					<?php endif;  ?><!-- End of Loop -->
				</div><!-- #wrapper -->
			</div><!-- #primary -->
		<?php endwhile; ?><!-- End of While Loop --> 
	<?php endif; ?><!-- End of have_posts() --> 
<?php get_footer(); 