<?php
/**
* The template for displaying category archive pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package GridRead WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

get_header(); ?>

<div class="gridread-main-wrapper gridread-clearfix" id="gridread-main-wrapper" itemscope="itemscope" itemtype="http://schema.org/Blog" role="main">
<div class="theiaStickySidebar">
<div class="gridread-main-wrapper-inside gridread-clearfix">

<?php gridread_before_main_content(); ?>

<div class="gridread-posts-wrapper" id="gridread-posts-wrapper">

<?php if ( !(gridread_get_option('hide_cats_title')) ) { ?>
<div class="gridread-page-header-outside">
<header class="gridread-page-header">
<div class="gridread-page-header-inside">
<?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?>
<?php if ( !(gridread_get_option('hide_cats_description')) ) { ?><?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?><?php } ?>
</div>
</header>
</div>
<?php } ?>

<div class="gridread-posts-content">
<?php if (have_posts()) : ?>

    <?php if ( 'grid' === gridread_post_summaries_style() ) { ?>

    <div class="gridread-posts gridread-posts-grid gridread-clearfix">
    <?php $gridread_post_counter=1; while (have_posts()) : the_post(); ?>

        <?php get_template_part( 'template-parts/content-grid' ); ?>

    <?php $gridread_post_counter++; endwhile; ?>
    </div>

    <?php } else { ?>

    <?php while (have_posts()) : the_post(); ?>
        <?php get_template_part( 'template-parts/content-nongrid' ); ?>
    <?php endwhile; ?>

    <?php } ?>
    <div class="clear"></div>

    <?php gridread_posts_navigation(); ?>

<?php else : ?>

  <?php get_template_part( 'template-parts/content', 'none' ); ?>

<?php endif; ?>
</div>

</div><!--/#gridread-posts-wrapper -->

<?php gridread_after_main_content(); ?>

</div>
</div>
</div><!-- /#gridread-main-wrapper -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>