wp-duckbehaviorjournal/archive-letter.php
Kumi a1fa110001
feat(archive-letter): improve UI and readability
Refactored layout of letters archive to use Bootstrap list group for a cleaner and more responsive design. Simplified author display to show 'et al.' when multiple authors are present, enhancing readability. Added margin top for consistent spacing.

Implements better UX for browsing letters.
2024-06-20 21:02:27 +02:00

41 lines
No EOL
1.5 KiB
PHP

<?php get_header(); ?>
<!-- Archive Content -->
<section class="container my-5">
<h1 class="display-4 text-center">Letters to the Editor</h1>
<div class="list-group">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>" class="list-group-item list-group-item-action">
<h5 class="mb-1"><?php the_title(); ?></h5>
<p class="mb-1">
<?php
$authors = get_post_meta(get_the_ID(), 'article_authors', true);
if (!empty($authors)) {
echo esc_html($authors[0]);
if (count($authors) > 1) {
echo ' et al.';
}
} else {
the_author();
}
?> | <?php the_date(); ?>
</p>
<p class="mb-1"><?php the_excerpt(); ?></p>
</a>
<?php endwhile;
else : ?>
<p><?php _e('Sorry, no letters found.', 'duck-behavior-journal'); ?></p>
<?php endif; ?>
</div>
<div class="row mt-4">
<div class="col-md-12">
<?php
echo paginate_links(array(
'total' => $wp_query->max_num_pages,
));
?>
</div>
</div>
</section>
<?php get_footer(); ?>