wp-duckbehaviorjournal/archive-letter.php

52 lines
1.9 KiB
PHP
Raw Normal View History

<?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="pagination col-md-12">
<?php
global $wp_query;
echo paginate_links(array(
'total' => $wp_query->max_num_pages,
'current' => max(1, get_query_var('paged')),
'format' => '?paged=%#%',
'show_all' => false,
'end_size' => 2,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => __('« Prev', 'duck-behavior-journal'),
'next_text' => __('Next »', 'duck-behavior-journal'),
'type' => 'plain'
));
?>
</div>
</div>
</section>
<?php get_footer(); ?>