Files
wordpress-theme-aksrt/single.php
T

98 lines
3.3 KiB
PHP

<?php
/**
* Single post template — Zibll-style shell.
*
* Composition lives in inc/helpers/aksrt-single.php.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
wp_reset_postdata();
while (have_posts()) :
the_post();
$post_id = (int) get_the_ID();
$ctx = function_exists('aksrt_single_build_context')
? aksrt_single_build_context($post_id)
: ['show_aside' => false, 'settings' => []];
if (function_exists('aksrt_single_is_docs_page') && aksrt_single_is_docs_page($post_id)) {
get_header();
get_template_part('templates/pages/page-documentnav');
get_footer();
return;
}
$settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : [];
$show_aside = !empty($ctx['show_aside']); // body site-layout-* is authoritative
get_header();
?>
<?php if (!empty($settings['reading_progress'])) : ?>
<div id="reading-progress-global" class="reading-progress-bar" role="progressbar" aria-label="<?php esc_attr_e('阅读进度', 'aksrt'); ?>" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"></div>
<?php endif; ?>
<?php if (is_active_sidebar('single_top_fluid')) : ?>
<div class="fluid-widget-wrap">
<?php dynamic_sidebar('single_top_fluid'); ?>
</div>
<?php endif; ?>
<main role="main" class="container<?php echo $show_aside ? '' : ' container--no-sidebar'; ?>">
<div class="content-wrap">
<div class="content-layout">
<?php if (is_active_sidebar('single_top_content')) : ?>
<?php dynamic_sidebar('single_top_content'); ?>
<?php endif; ?>
<?php
if (function_exists('aksrt_single')) {
aksrt_single($ctx);
}
?>
<?php if (comments_open() || get_comments_number()) : ?>
<?php comments_template(); ?>
<?php endif; ?>
<?php if (is_active_sidebar('single_bottom_content')) : ?>
<?php dynamic_sidebar('single_bottom_content'); ?>
<?php endif; ?>
</div>
</div>
<?php
if (function_exists('aksrt_single_render_aside')) {
aksrt_single_render_aside($ctx);
}
?>
</main>
<?php if (!empty($ctx['show_toc'])) : ?>
<button type="button" class="toc-float-btn" aria-label="<?php esc_attr_e('打开目录', 'aksrt'); ?>"><i class="fa fas fa-list-ul" aria-hidden="true"></i></button>
<div class="toc-drawer-overlay"></div>
<aside class="toc-drawer posts-nav-box" data-title="<?php echo esc_attr((string) ($ctx['toc_title'] ?? __('文章目录', 'aksrt'))); ?>" aria-label="<?php echo esc_attr((string) ($ctx['toc_title'] ?? __('文章目录', 'aksrt'))); ?>">
<div class="toc-drawer__head">
<h3><?php echo esc_html((string) ($ctx['toc_title'] ?? __('文章目录', 'aksrt'))); ?></h3>
<button type="button" class="toc-drawer__close" aria-label="<?php esc_attr_e('关闭目录', 'aksrt'); ?>"><i class="fa fas fa-times" aria-hidden="true"></i></button>
</div>
<ol class="toc-list"></ol>
</aside>
<?php endif; ?>
<?php if (!empty($settings['lightbox'])) : ?>
<div class="lightbox-overlay" id="lightbox-overlay" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('图片预览', 'aksrt'); ?>" aria-hidden="true">
<button type="button" class="lightbox-close" aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fa fas fa-times" aria-hidden="true"></i></button>
<img src="" alt="" class="lightbox-img">
<div class="lightbox-caption" aria-live="polite"></div>
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php get_footer(); ?>