<?php
/*
 * The category pages.
 * 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 = isset( $confin_meta['content_spacings'] ) ? $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( 'blog_sidebar_position' );
	if (isset($_GET['sidebar'])) {
	  $confin_sidebar_position = $_GET['sidebar'];
	}
	$confin_sidebar_position = $confin_sidebar_position ? $confin_sidebar_position : 'sidebar-right';
	// Sidebar Position
	if ( $confin_sidebar_position === 'sidebar-hide' ) {
		$layout_class = 'col-md-12';
		$confin_sidebar_class = 'hide-sidebar';
	} elseif ( $confin_sidebar_position === 'sidebar-left' ) {
		$layout_class = 'col-md-8 col-md-push-4';
		$confin_sidebar_class = 'left-sidebar';
	} else {
		$layout_class = 'col-md-8';
		$confin_sidebar_class = 'right-sidebar';
	}
	?>
<div class="blog-pg-section section-padding">
	<div class="container content-area <?php echo esc_attr( $confin_content_padding .' '. $confin_sidebar_class ); ?>" style="<?php echo esc_attr( $confin_custom_padding ); ?>">
		<div class="row">
			<div class="blog-wrap <?php echo esc_attr( $layout_class ); ?>">
				<div class="blog-content">
				<?php
				if ( have_posts() ) :
					/* Start the Loop */
					while ( have_posts() ) : the_post();
						get_template_part( 'theme-layouts/post/content' );
					endwhile;
				else :
					get_template_part( 'theme-layouts/post/content', 'none' );
				endif;
				confin_paging_nav();
		    wp_reset_postdata(); ?>
		    </div>
			</div><!-- Content Area -->
			<?php
			if ( $confin_sidebar_position !== 'sidebar-hide' ) {
				get_sidebar(); // Sidebar
			} ?>
		</div>
	</div>
</div>
<?php
get_footer();