Sidebar visibility had two disconnected decisions: the body site-layout-* class (via aksrt_is_show_sidebar_filter) only checked widget activity for singles, while the homepage aside renderer skipped the column and sidebar.php rendered an empty one. With the toggle on and no widgets, the homepage kept a reserved gutter and squeezed the main content aside. - collapse every scene to no-sidebar when the sidebar widget stack is empty - resolve home_sidebar before the page branch so a static front page is checked against the zones the homepage renders - guard the homepage aside with aksrt_is_show_sidebar() alone and drop the duplicate aksrt_homepage_has_sidebar gate - early-return sidebar.php instead of rendering an empty column - drop dead code: archive helper $preferred param, wp_is_mobile fallback, container--no-sidebar class, unreachable front-page fallback - update post-visual-contract to pin the single visibility decision Verification: php -l on all changed files; node --test tests/widget-system/*.test.cjs 242/243 (the toast-contract failure is pre-existing and unrelated).
78 lines
1.9 KiB
PHP
78 lines
1.9 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">
|
|
<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(); ?>
|