<?php
/*
 * The template for displaying all single posts.
 * Author & Copyright: themexshaper
 * URL: http://themeforest.net/user/themexshaper
 */
get_header();
	// Metabox
	$confin_id    = ( isset( $post ) ) ? $post->ID : 0;
	$confin_id    = ( is_home() ) ? get_option( 'page_for_posts' ) : $confin_id;
	$confin_meta  = get_post_meta( $confin_id, 'page_type_metabox', true );
	if ( $confin_meta ) {
		$confin_content_padding = $confin_meta['content_spacings'];
	} else { $confin_content_padding = ''; }
	// Padding - Metabox
	if ( $confin_content_padding && $confin_content_padding !== 'padding-default' ) {
		$confin_content_top_spacings = $confin_meta['content_top_spacings'];
		$confin_content_bottom_spacings = $confin_meta['content_bottom_spacings'];
		if ( $confin_content_padding === 'padding-custom' ) {
			$confin_content_top_spacings = $confin_content_top_spacings ? 'padding-top:'. confin_check_px($confin_content_top_spacings) .';' : '';
			$confin_content_bottom_spacings = $confin_content_bottom_spacings ? 'padding-bottom:'. confin_check_px($confin_content_bottom_spacings) .';' : '';
			$confin_custom_padding = $confin_content_top_spacings . $confin_content_bottom_spacings;
		} else {
			$confin_custom_padding = '';
		}
	} else {
		$confin_custom_padding = '';
	}
	// Theme Options
	$confin_sidebar_position = cs_get_option( 'project_sidebar_position' );
	$confin_single_comment = cs_get_option( 'project_comment_form' );
	$confin_sidebar_position = $confin_sidebar_position ? $confin_sidebar_position : 'sidebar-hide';
	// Sidebar Position
	if ( $confin_sidebar_position === 'sidebar-left' ) {
		$confin_layout_class = 'col-md-8 col-md-push-4';
		$confin_sidebar_class = 'left-sidebar';
	} elseif( $confin_sidebar_position === 'sidebar-right' ) {
		$confin_layout_class = 'col-md-8';
		$confin_sidebar_class = 'right-sidebar';
	} else {
		$confin_layout_class = 'col-md-12';
		$confin_sidebar_class = 'hide-sidebar';
	} ?>
<div class="case-single-section section-padding <?php echo esc_attr( $confin_content_padding .' '. $confin_sidebar_class ); ?>" style="<?php echo esc_attr( $confin_custom_padding ); ?>">
	<div class="container content-area ">
		<div class="row">
			<div class="<?php echo esc_attr( $confin_layout_class ); ?>">
				<div class="project-single-content">
					<?php
					if ( have_posts() ) :
						/* Start the Loop */
						while ( have_posts() ) : the_post();
							if ( post_password_required() ) {
									echo '<div class="password-form">'.get_the_password_form().'</div>';
								} else {
									get_template_part( 'theme-layouts/post/project', 'content' );

								}
						endwhile;
					else :
						get_template_part( 'theme-layouts/post/content', 'none' );
					endif; ?>
				</div><!-- Blog Div -->
				<?php
		    confin_paging_nav();
		    wp_reset_postdata(); ?>
			</div><!-- Content Area -->
				<?php
				if ( $confin_sidebar_position !== 'sidebar-hide' ) {
					get_sidebar(); // Sidebar
				} ?>
		</div>
	</div>
</div>
<?php
get_footer();