Files
wordpress-theme-aksrt/single.php
T

79 lines
2.0 KiB
PHP

<?php
/**
* Single post template — legacy-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()) : ?>
<?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 endwhile; ?>
<?php get_footer(); ?>