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

get_header();

$cat_title = ethrik_get_option('cat_title');
$cat_page_breadcrumb = ethrik_get_option('cat_page_breadcrumb');
$ethrik_cat_layout = ethrik_get_option('ethrik_cat_layout');

	
?>
	
	<!-- Category Breadcrumb -->
	<?php if($cat_title == true) : ?>
	<div class="theme-breadcrumb__Wrapper theme-breacrumb-area">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-md-12">

                	<h1 class="theme-breacrumb-title">
						<?php echo esc_html__('Category','ethrik').' :'; ?>  <?php single_cat_title(); ?>
					</h1>

					<?php if($cat_page_breadcrumb == true) : ?>
					<div class="breadcrumb-nav-top">
						<ul>
							<li class="breadcrumb-home-menu"><a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('Home', 'ethrik'); ?></a></li>
							<li class="breadcrumb-item-menu"><?php single_cat_title(); ?></li>
						</ul>
					</div>
					<?php endif; ?>

				</div>
            </div>
        </div>
    </div>
	<?php endif; ?>
    <!-- Category Breadcrumb End -->

	<section id="main-content" class="blog main-container blog-spacing" role="main">
		<div class="container">
			<div class="row">
				<div class="<?php if(is_active_sidebar('sidebar-1')) { echo "col-lg-8"; } else { echo "col-lg-12";}?> col-md-12">
					<div class="category-layout-two main-blog-layout blog-new-layout theme-layout-mainn">
						<?php if (have_posts()): ?>
						
							<div class="main-content-inner category-layout-one <?php if(has_post_thumbnail()) { echo "has-fblog"; } else { echo "no-fblog"; } ?>">
								<div class="row">
									<?php while (have_posts()): the_post(); ?>
										<div class="<?php
											if($ethrik_cat_layout == 'cat-one'){
												echo "col-lg-12 col-md-12 cat_list_layout";
											}elseif($ethrik_cat_layout == 'cat-two'){
												echo "col-lg-6 col-md-6 cat_grid_layout";
											}
										?> custom_cat">
											<?php get_template_part('template-parts/content', get_post_format());?>
										</div>
									<?php endwhile; ?>
								</div>
							</div>	
							
							<div class="theme-pagination-style">
								<?php
									the_posts_pagination(array(
										'next_text' => '<i class="icofont-long-arrow-right"></i>',
										'prev_text' => '<i class="icofont-long-arrow-left"></i>',
										'screen_reader_text' => ' ',
										'type'               => 'list'
									));
								?>
							</div>
							
							<?php else : get_template_part('template-parts/content', 'none'); ?>
							
						<?php endif; ?>
					</div>
				</div>
				<?php get_sidebar(); ?>
			</div>
		</div>
	</section>

<?php get_footer(); ?>
