清 single/home 残层:删 sidebar prepend 与 author-bar query-var
去掉 generic sidebar 的 prepend patch、author-bar ambient 回退, 以及 homepage section 多余 wrapper,保持主线闭环更干净。
This commit is contained in:
@@ -776,20 +776,10 @@ if (!function_exists('aksrt_homepage_render_section')) {
|
|||||||
return;
|
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);
|
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
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Sidebar template.
|
* Sidebar template for generic pages.
|
||||||
|
*
|
||||||
|
* Single/home own their asides. This template only serves archive/page contexts.
|
||||||
*
|
*
|
||||||
* @package AKSRT
|
* @package AKSRT
|
||||||
*/
|
*/
|
||||||
@@ -8,37 +10,30 @@
|
|||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
if (wp_is_mobile()) {
|
if (wp_is_mobile()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sidebar_id = function_exists('aksrt_resolve_sidebar_id')
|
$sidebar_id = function_exists('aksrt_resolve_sidebar_id')
|
||||||
? aksrt_resolve_sidebar_id()
|
? aksrt_resolve_sidebar_id()
|
||||||
: 'sidebar-blog';
|
: 'sidebar-blog';
|
||||||
|
|
||||||
$sidebar_prepend_html = (string) get_query_var('aksrt_sidebar_prepend_html', '');
|
if (!is_active_sidebar($sidebar_id)
|
||||||
|
&& !is_active_sidebar('all_sidebar_top')
|
||||||
if ($sidebar_prepend_html === ''
|
&& !is_active_sidebar('all_sidebar_bottom')) {
|
||||||
&& !is_active_sidebar($sidebar_id)
|
return;
|
||||||
&& !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'); ?>">
|
<div class="sidebar" role="complementary" aria-label="<?php esc_attr_e('侧栏', 'aksrt'); ?>">
|
||||||
<?php if ($sidebar_prepend_html !== '') : ?>
|
<?php if (is_active_sidebar('all_sidebar_top')) : ?>
|
||||||
<?php echo $sidebar_prepend_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
<?php dynamic_sidebar('all_sidebar_top'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (is_active_sidebar('all_sidebar_top')) : ?>
|
<?php if (is_active_sidebar($sidebar_id)) : ?>
|
||||||
<?php dynamic_sidebar('all_sidebar_top'); ?>
|
<?php dynamic_sidebar($sidebar_id); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (is_active_sidebar($sidebar_id)) : ?>
|
<?php if (is_active_sidebar('all_sidebar_bottom')) : ?>
|
||||||
<?php dynamic_sidebar($sidebar_id); ?>
|
<?php dynamic_sidebar('all_sidebar_bottom'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if (is_active_sidebar('all_sidebar_bottom')) : ?>
|
|
||||||
<?php dynamic_sidebar('all_sidebar_bottom'); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* Shared author info bar for single post content.
|
* Shared author info bar for single post content.
|
||||||
*
|
*
|
||||||
* Prefer explicit $args (third arg of get_template_part).
|
* Contract: get_template_part(..., null, $args)
|
||||||
* Ambient query-var fallback is kept only for residual callers.
|
|
||||||
*
|
*
|
||||||
* @package AKSRT
|
* @package AKSRT
|
||||||
*/
|
*/
|
||||||
@@ -11,18 +10,10 @@
|
|||||||
defined('ABSPATH') || exit;
|
defined('ABSPATH') || exit;
|
||||||
|
|
||||||
$args = is_array($args ?? null) ? $args : [];
|
$args = is_array($args ?? null) ? $args : [];
|
||||||
|
$extra_class = (string) ($args['extra_class'] ?? '');
|
||||||
$extra_class = (string) ($args['extra_class'] ?? get_query_var('aksrt_author_bar_class', ''));
|
$show_actions = !empty($args['show_actions']);
|
||||||
$show_actions = array_key_exists('show_actions', $args)
|
$show_bio = !empty($args['show_bio']);
|
||||||
? (bool) $args['show_actions']
|
$meta_items = is_array($args['meta_items'] ?? null) ? array_values(array_filter($args['meta_items'], static function ($meta_item) {
|
||||||
: (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) {
|
|
||||||
if (is_array($meta_item)) {
|
if (is_array($meta_item)) {
|
||||||
return !empty($meta_item['text']);
|
return !empty($meta_item['text']);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user