Continues the Bookshelf history. The three plugins tracked there are consolidated into umbra-bookshelf/ and this repository becomes the canonical home for the plugin and the theme. bd-bookshelf/ -> theme/ separate artifact, name unchanged (root specs) -> umbra-bookshelf/spec/ aligned to Umbra Bookshelf old plugin zips -> archive/pre-umbra-releases/ Adds a repository README and drops the Bookshelf closure notice.
135 lines
5.8 KiB
PHP
135 lines
5.8 KiB
PHP
<?php
|
|
// Copyright 2026 Umbra Tools (umbratools.com)
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
/**
|
|
* Template Name: Blog
|
|
*
|
|
* @package BD_Murphy
|
|
*/
|
|
|
|
get_header();
|
|
?>
|
|
|
|
<div class="page-container with-sidebar">
|
|
<div class="page-content">
|
|
<div class="blog-container">
|
|
<header class="page-header">
|
|
<h1 class="page-title"><?php single_post_title('', true) ?: esc_html_e('Blog', 'bd-bookshelf'); ?></h1>
|
|
</header>
|
|
|
|
<?php
|
|
// Category filter dropdown
|
|
$categories = get_categories(array(
|
|
'hide_empty' => true,
|
|
'orderby' => 'name',
|
|
'order' => 'ASC',
|
|
));
|
|
|
|
if (!empty($categories)) {
|
|
$selected_cat = isset($_GET['category']) ? absint($_GET['category']) : 0;
|
|
?>
|
|
<div class="blog-filter">
|
|
<form method="get" action="">
|
|
<label for="category-filter" class="screen-reader-text"><?php esc_html_e('Filter by category', 'bd-bookshelf'); ?></label>
|
|
<select name="category" id="category-filter" onchange="this.form.submit()">
|
|
<option value=""><?php esc_html_e('All Categories', 'bd-bookshelf'); ?></option>
|
|
<?php foreach ($categories as $cat) : ?>
|
|
<option value="<?php echo esc_attr($cat->term_id); ?>" <?php selected($selected_cat, $cat->term_id); ?>>
|
|
<?php echo esc_html($cat->name); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<noscript><button type="submit" class="button"><?php esc_html_e('Filter', 'bd-bookshelf'); ?></button></noscript>
|
|
</form>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<div class="blog-list">
|
|
<?php
|
|
// Build query with category filter
|
|
$query_args = array(
|
|
'post_type' => 'post',
|
|
'post_status' => 'publish',
|
|
'posts_per_page' => get_option('posts_per_page', 10),
|
|
);
|
|
|
|
if (!empty($selected_cat)) {
|
|
$query_args['cat'] = $selected_cat;
|
|
}
|
|
|
|
$blog_query = new WP_Query($query_args);
|
|
|
|
if ($blog_query->have_posts()) :
|
|
while ($blog_query->have_posts()) :
|
|
$blog_query->the_post();
|
|
?>
|
|
<article id="post-<?php the_ID(); ?>" <?php post_class('blog-entry'); ?>>
|
|
<div class="blog-entry-inner">
|
|
<?php if (has_post_thumbnail()) : ?>
|
|
<div class="blog-entry-thumbnail">
|
|
<a href="<?php the_permalink(); ?>">
|
|
<?php the_post_thumbnail('blog-thumb'); ?>
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<header class="blog-entry-header">
|
|
<h2 class="blog-entry-title">
|
|
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
|
|
</h2>
|
|
<div class="blog-entry-meta">
|
|
<span class="blog-entry-date"><?php bdm_posted_on(); ?></span>
|
|
<?php
|
|
$post_categories = get_the_category();
|
|
if (!empty($post_categories)) {
|
|
printf('<span class="blog-entry-category">%s</span>', esc_html($post_categories[0]->name));
|
|
}
|
|
if (get_theme_mod('show_read_time', true)) {
|
|
printf('<span class="blog-entry-readtime">%s</span>', bdm_display_reading_time());
|
|
}
|
|
?>
|
|
</div>
|
|
<?php if (has_tag()) : ?>
|
|
<div class="blog-entry-tags">
|
|
<?php the_tags('<span class="tags-label">' . esc_html__('Tags:', 'bd-bookshelf') . '</span> ', ', '); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</header>
|
|
|
|
<div class="blog-entry-excerpt">
|
|
<?php the_excerpt(); ?>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
<?php
|
|
endwhile;
|
|
|
|
the_posts_pagination(array(
|
|
'mid_size' => 2,
|
|
'prev_text' => esc_html__('Previous', 'bd-bookshelf'),
|
|
'next_text' => esc_html__('Next', 'bd-bookshelf'),
|
|
));
|
|
|
|
wp_reset_postdata();
|
|
else :
|
|
?>
|
|
<p class="no-posts"><?php esc_html_e('No posts found.', '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();
|