From 91945e200662b4bf3206d84c7eeba2003a57ff89 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Jul 2026 21:56:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=20single/home=20=E6=AE=8B=E5=B1=82?= =?UTF-8?q?=EF=BC=9A=E5=88=A0=20sidebar=20prepend=20=E4=B8=8E=20author-bar?= =?UTF-8?q?=20query-var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去掉 generic sidebar 的 prepend patch、author-bar ambient 回退, 以及 homepage section 多余 wrapper,保持主线闭环更干净。 --- inc/helpers/aksrt-homepage.php | 16 ++-------- sidebar.php | 43 ++++++++++++--------------- templates/parts/single-author-bar.php | 19 ++++-------- 3 files changed, 27 insertions(+), 51 deletions(-) diff --git a/inc/helpers/aksrt-homepage.php b/inc/helpers/aksrt-homepage.php index 11d5eabf..27d3c5c1 100644 --- a/inc/helpers/aksrt-homepage.php +++ b/inc/helpers/aksrt-homepage.php @@ -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 '
'; - echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped - echo '
'; } } diff --git a/sidebar.php b/sidebar.php index 14aa3fc6..f68c2d9a 100644 --- a/sidebar.php +++ b/sidebar.php @@ -1,6 +1,8 @@ diff --git a/templates/parts/single-author-bar.php b/templates/parts/single-author-bar.php index cd67ad66..4be2f50a 100644 --- a/templates/parts/single-author-bar.php +++ b/templates/parts/single-author-bar.php @@ -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']); }