清 single/home 残层:删 sidebar prepend 与 author-bar query-var

去掉 generic sidebar 的 prepend patch、author-bar ambient 回退,
以及 homepage section 多余 wrapper,保持主线闭环更干净。
This commit is contained in:
2026-07-09 21:56:30 +08:00
parent 29bd9bd152
commit 91945e2006
3 changed files with 27 additions and 51 deletions
+3 -13
View File
@@ -776,20 +776,10 @@ if (!function_exists('aksrt_homepage_render_section')) {
return;
}
ob_start();
// Fixed homepage owns these sections directly.
// Keep the existing hero/banner templates as section implementations,
// but do not re-wrap them in a freeform module bridge.
get_template_part('templates/parts/home-modules/module', $type);
$html = trim((string) ob_get_clean());
if ($html === '') {
return;
}
$class = $type === 'hero'
? 'aksrt-homepage__hero home-modules home-modules--fullbleed'
: 'aksrt-homepage__banner home-modules';
echo '<div class="' . esc_attr($class) . '">';
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '</div>';
}
}
+19 -24
View File
@@ -1,6 +1,8 @@
<?php
/**
* Sidebar template.
* Sidebar template for generic pages.
*
* Single/home own their asides. This template only serves archive/page contexts.
*
* @package AKSRT
*/
@@ -8,37 +10,30 @@
defined('ABSPATH') || exit;
if (wp_is_mobile()) {
return;
return;
}
$sidebar_id = function_exists('aksrt_resolve_sidebar_id')
? aksrt_resolve_sidebar_id()
: 'sidebar-blog';
? aksrt_resolve_sidebar_id()
: 'sidebar-blog';
$sidebar_prepend_html = (string) get_query_var('aksrt_sidebar_prepend_html', '');
if ($sidebar_prepend_html === ''
&& !is_active_sidebar($sidebar_id)
&& !is_active_sidebar('all_sidebar_top')
&& !is_active_sidebar('all_sidebar_bottom')) {
return;
if (!is_active_sidebar($sidebar_id)
&& !is_active_sidebar('all_sidebar_top')
&& !is_active_sidebar('all_sidebar_bottom')) {
return;
}
?>
<div class="sidebar" role="complementary" aria-label="<?php esc_attr_e('侧栏', 'aksrt'); ?>">
<?php if ($sidebar_prepend_html !== '') : ?>
<?php echo $sidebar_prepend_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php endif; ?>
<?php if (is_active_sidebar('all_sidebar_top')) : ?>
<?php dynamic_sidebar('all_sidebar_top'); ?>
<?php endif; ?>
<?php if (is_active_sidebar('all_sidebar_top')) : ?>
<?php dynamic_sidebar('all_sidebar_top'); ?>
<?php endif; ?>
<?php if (is_active_sidebar($sidebar_id)) : ?>
<?php dynamic_sidebar($sidebar_id); ?>
<?php endif; ?>
<?php if (is_active_sidebar($sidebar_id)) : ?>
<?php dynamic_sidebar($sidebar_id); ?>
<?php endif; ?>
<?php if (is_active_sidebar('all_sidebar_bottom')) : ?>
<?php dynamic_sidebar('all_sidebar_bottom'); ?>
<?php endif; ?>
<?php if (is_active_sidebar('all_sidebar_bottom')) : ?>
<?php dynamic_sidebar('all_sidebar_bottom'); ?>
<?php endif; ?>
</div>
+5 -14
View File
@@ -2,8 +2,7 @@
/**
* Shared author info bar for single post content.
*
* Prefer explicit $args (third arg of get_template_part).
* Ambient query-var fallback is kept only for residual callers.
* Contract: get_template_part(..., null, $args)
*
* @package AKSRT
*/
@@ -11,18 +10,10 @@
defined('ABSPATH') || exit;
$args = is_array($args ?? null) ? $args : [];
$extra_class = (string) ($args['extra_class'] ?? get_query_var('aksrt_author_bar_class', ''));
$show_actions = array_key_exists('show_actions', $args)
? (bool) $args['show_actions']
: (bool) get_query_var('aksrt_author_bar_actions', false);
$show_bio = array_key_exists('show_bio', $args)
? (bool) $args['show_bio']
: (bool) get_query_var('aksrt_author_bar_bio', false);
$meta_items = array_key_exists('meta_items', $args)
? $args['meta_items']
: get_query_var('aksrt_author_bar_meta_items', []);
$meta_items = is_array($meta_items) ? array_values(array_filter($meta_items, static function ($meta_item) {
$extra_class = (string) ($args['extra_class'] ?? '');
$show_actions = !empty($args['show_actions']);
$show_bio = !empty($args['show_bio']);
$meta_items = is_array($args['meta_items'] ?? null) ? array_values(array_filter($args['meta_items'], static function ($meta_item) {
if (is_array($meta_item)) {
return !empty($meta_item['text']);
}