Files
Bookshelf/bd-bookshelf/archive-series.php
bdm 38cdebd0c6 Track Bookshelf WordPress theme, plugins and specs
Initial import of the bdmurphy Bookshelf work: the bd-bookshelf theme,
bd-bookshelf-plugin, bd-bookshelfhelper and bd-simpleemail plugins, plus
the specification documents, mockups and release archives.
2026-09-28 06:24:25 -07:00

77 lines
2.8 KiB
PHP

<?php
/**
* Template Name: Series Listing
*
* @package BD_Murphy
*/
get_header();
?>
<div class="page-container with-sidebar">
<div class="page-content">
<div class="series-container">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e('Series', 'bd-bookshelf'); ?></h1>
</header>
<div class="series-list">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
$series_id = get_the_ID();
$name = esc_html(get_the_title());
$blurb = wp_kses_post(get_the_excerpt() ?: '');
$book_count = 0;
if (class_exists('BD_BookShelfHelper')) {
$book_count = BD_BookShelfHelper::get_series_book_count($series_id);
} else {
$books_in_series = get_post_meta($series_id, '_bdm_series_books', true);
if (is_array($books_in_series)) {
$book_count = count($books_in_series);
}
}
?>
<article class="series-card" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<?php if (has_post_thumbnail()) : ?>
<?php the_post_thumbnail('series-card'); ?>
<?php endif; ?>
</a>
<h2 class="series-name">
<a href="<?php the_permalink(); ?>"><?php echo $name; ?></a>
</h2>
<p class="series-blurb"><?php echo $blurb; ?></p>
<p class="series-book-count">
<?php
printf(
esc_html(_n('%d book', '%d books', $book_count, 'bd-bookshelf')),
$book_count
);
?>
</p>
</article>
<?php
endwhile;
else :
?>
<p class="no-series"><?php esc_html_e('No series available yet.', 'bd-bookshelf'); ?></p>
<?php endif; ?>
</div>
</div>
</div>
<aside class="page-sidebar">
<?php if (is_active_sidebar('home-sidebar')) : ?>
<div class="home-sidebar">
<?php dynamic_sidebar('home-sidebar'); ?>
</div>
<?php endif; ?>
</aside>
</div>
<?php
get_footer();