<?php
/**
 * The template for displaying archive pages
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package benqu
 */

get_header();
benqu_get_breadcrumb();
$pfy_cat_st = get_term_meta( get_queried_object_id(), 'benqu_cate_meta', true );
$pfy_cat_template = !empty( $pfy_cat_st['pfy_cat_layout'] )? $pfy_cat_st['pfy_cat_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';
}
?>
<div class="pfy-main-container">
	<div class="container">
		<div class="row">
			<div class="<?php echo esc_attr($benquPostClass);?>">
				<?php if (have_posts() ): ?>
				<?php
					$pfy_global_cat = cs_get_option( 'pfy_cat_global_layout' );
					if( is_category() && !empty( $pfy_cat_st  ) ) {
						get_template_part( 'template-parts/category-layout/'.$pfy_cat_template.'' );
					} elseif( class_exists( 'CSF' ) && !empty( $pfy_global_cat ) ) {
						get_template_part( 'template-parts/category-layout/'.$pfy_global_cat.'' );
					} else {
						get_template_part( 'template-parts/category-layout/cat-layout', 'one' );
					}
				?>
				<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
get_footer();
