<?php
/**
 * The main template file
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package benqu
 */

get_header();
benqu_display_blog_breadcrumb();
$blog_global_layout = cs_get_option( 'blog_global_layout' );
$benquPostClass = '';
if(is_active_sidebar('sidebar-1')) {
	$benquPostClass = 'col-xl-8 benqu-sticky-item';
} else {
	$benquPostClass = 'col-lg-10 offset-lg-1 no-active-sidebar';
}

if( class_exists( 'CSF' ) && !empty( $blog_global_layout ) && $blog_global_layout != "blog-layout-default") { ?>

	<div class="pfy-main-container">
		<div class="container">
			<div class="row">
				<div class="<?php echo esc_attr($benquPostClass);?>">
					<?php if (have_posts() ): ?>
						<?php get_template_part( 'template-parts/blog-layout/' . $blog_global_layout ); ?>
						<div class="pfy-pagination">
							<?php benqu_pagination(); ?>
						</div>
					<?php else: ?>
						<?php get_template_part( 'template-parts/content', 'none'); ?>
					<?php endif; ?>
				</div>
				<?php get_sidebar();?>
			</div>
		</div>
	</div>
<?php } else { ?>
	<div class="pfy-post-main-post-wrap">
		<div class="container">
			<div class="row benqu-sticky-wrap">
				<div class="<?php echo esc_attr($benquPostClass);?>">
					<?php pfy_post_main_loop();?>
				</div>				
				<?php get_sidebar(); ?>
			</div>
		</div>
	</div>
<?php }
get_footer();
