<?php
if (!defined('ABSPATH')) { exit; }
get_header();
?>

<div class="bp-page-head">
    <h1><?php echo esc_html(get_bloginfo('name')); ?></h1>
    <div class="bp-meta"><?php echo esc_html(get_bloginfo('description')); ?></div>
</div>

<?php if (have_posts()): ?>
    <?php while (have_posts()): the_post(); ?>
        <article class="bp-article-card">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
            <div class="bp-meta">
                <?php echo esc_html(get_the_date('Y-m-d')); ?> | <?php the_category(', '); ?>
            </div>
            <p class="bp-excerpt"><?php echo esc_html(wp_trim_words(get_the_excerpt(), 35)); ?></p>
        </article>
    <?php endwhile; ?>

    <div class="bp-pagination">
        <?php echo wp_kses_post(paginate_links([
            'type' => 'plain',
        ])); ?>
    </div>
<?php else: ?>
    <div class="bp-article-card">
        <p>Brak wpisow.</p>
    </div>
<?php endif; ?>

<?php get_footer(); ?>

