<?php
/** Category news archive. @package Gustavo_Portfolio */

get_header();
?>
<main id="primary" class="site-main news-index news-index--category">
	<header class="news-page-heading">
		<div class="site-shell">
			<h1><?php single_cat_title(); ?></h1>
			<?php if ( category_description() ) : ?><div class="news-page-heading__description"><?php echo wp_kses_post( category_description() ); ?></div><?php endif; ?>
		</div>
	</header>
	<div class="site-shell news-index__content">
		<?php if ( have_posts() ) : ?>
			<div class="latest-news-grid">
				<?php
				$gustavoo_news_index = 0;
				$gustavoo_displayed_post_ids = array();
				while ( have_posts() ) {
					the_post();
					$gustavoo_displayed_post_ids[] = get_the_ID();
					get_template_part( 'template-parts/global/latest-news-card', null, array( 'featured' => 0 === $gustavoo_news_index ) );
					$gustavoo_news_index++;
				}
				?>
			</div>
			<?php get_template_part( 'template-parts/global/latest-news-list', null, array( 'exclude' => $gustavoo_displayed_post_ids, 'category_id' => get_queried_object_id() ) ); ?>
			<?php gustavoo_portfolio_pagination(); ?>
		<?php else : ?>
			<?php get_template_part( 'template-parts/content/content', 'none' ); ?>
		<?php endif; ?>
	</div>
</main>
<?php get_footer(); ?>
