<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package aac
 */

get_header();

$args = array(
    'post_type'      => 'post',
    'posts_per_page' => 2,
	'post__not_in'   => array( get_the_ID() ),
	'orderby'        => 'date',
	'order'          => 'DESC',
);

$recent_posts = new WP_Query( $args );
?>

<main id="primary" class="site-main">
	<section class="box-1">
		<div class="box-bg">
			<?php aac_post_thumbnail(); ?>
			<!-- <img src="/wp-content/uploads/2025/10/article.jpg" alt=""> -->
		</div>

		<div class="article-bg-1">
			<img src="/wp-content/uploads/2025/10/artilce-bg-1.svg" alt="">
		</div>
		<div class="article-bg-2">
			<img src="/wp-content/uploads/2025/10/artilce-bg-2.svg" alt="">
		</div>

		<div class="container-mini">
			<?php
				while ( have_posts() ) :
					the_post();
					get_template_part( 'template-parts/content', get_post_type() );
				endwhile;
			?>
		</div>
	</section>

	<section class="box-2">
		<div class="box-bg">
			<img src="/wp-content/uploads/2025/10/img-5.svg" alt="">
		</div>
		<div class="container">
			<div class="row">
				<div class="box-title">
					<h2>Te artykuły też warto przeczytać</h2>
				</div>
				<div class="box-list">
                    <?php foreach ($recent_posts -> posts as $item) : ?>
                        <?php
                            get_template_part('inc/template-article-card', null, [
                                'image' => get_the_post_thumbnail_url($item->ID),
                                'title' => $item->post_title,
                                'link'  => get_the_permalink($item->ID),
								'category' => get_the_category($item->ID)
                            ]);
                        ?>
                    <?php endforeach; ?>
                    <?php
                        get_template_part('inc/template-article-more-card', null, [
                            'image' => '/wp-content/uploads/2025/11/6946c73e45f3b80cd8ffcf6b3c9bf31fca7f2464.jpg',
                            'title' => 'Chcesz dowiedzieć się więcej? Zapraszamy do dalszej lektury',
                            'link_text' => 'Zobacz wszystkie artykuły',
                            'link'  => get_permalink(94),
                        ]);
                    ?>
                </div>
			</div>
		</div>
	</section>
</main>
<?php
get_sidebar();
get_footer();
