Zibll 主线收口:减层统一 single 与首页主内容流

把 single.php 收成薄壳,文章组合迁入 aksrt-single;
首页去掉 legacy module 桥接与多余 stream 文案层,
保留 renderer / tab-panel / sort 协议并形成页面自有 aside。
This commit is contained in:
kate522 committed 2026-07-09 21:49:46 +08:00
1 parent 256c23b226
commit 29bd9bd152
5 files changed
+825 -523

No files matched your search

+37 -56
View File
@@ -764,35 +764,38 @@ if (!function_exists('aksrt_homepage_render_posts_grid')) {
}
}
if (!function_exists('aksrt_homepage_render_system_module')) {
if (!function_exists('aksrt_homepage_render_section')) {
/**
* Render a legacy homepage module inside the fixed homepage layout.
* Render a first-class homepage section (hero / banner).
*
* These are fixed homepage sections, not a freeform module canvas bridge.
*/
function aksrt_homepage_render_system_module(string $type, string $wrapper_class = 'home-modules', array $config = []): void {
function aksrt_homepage_render_section(string $type): void {
$type = sanitize_key($type);
if ($type === '') {
if (!in_array($type, ['hero', 'banner'], true)) {
return;
}
set_query_var('aksrt_module_config', $config);
ob_start();
get_template_part('templates/parts/home-modules/module', $type);
set_query_var('aksrt_module_config', null);
$module_html = trim((string) ob_get_clean());
if ($module_html === '') {
$html = trim((string) ob_get_clean());
if ($html === '') {
return;
}
echo '<div class="' . esc_attr(trim($wrapper_class)) . '">';
echo $module_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$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>';
}
}
if (!function_exists('aksrt_homepage_render_layout')) {
/**
* Render the fixed homepage layout directly.
* Render the fixed homepage layout (Zibll latest-first content stream).
*/
function aksrt_homepage_render_layout(): void {
$current_page = aksrt_homepage_get_current_page();
@@ -807,18 +810,15 @@ if (!function_exists('aksrt_homepage_render_layout')) {
? AKSRT_Settings::home_list_title()
: __('最新发布', 'aksrt');
?>
<main id="main-content" class="site-main container aksrt-homepage" tabindex="-1">
<main id="main-content" role="main" class="site-main container aksrt-homepage" tabindex="-1">
<?php
aksrt_homepage_render_widget_zone(
['all_top_fluid', 'home_top_fluid'],
'fluid-widget-wrap aksrt-homepage__fluid-zone aksrt-homepage__fluid-zone--top'
);
if ($hero_on) {
aksrt_homepage_render_system_module(
'hero',
'aksrt-homepage__hero home-modules home-modules--fullbleed aksrt-homepage__system-modules aksrt-homepage__system-modules--hero'
);
if ($hero_on && function_exists('aksrt_homepage_render_section')) {
aksrt_homepage_render_section('hero');
}
?>
@@ -831,34 +831,19 @@ if (!function_exists('aksrt_homepage_render_layout')) {
'aksrt-homepage__content-zone aksrt-homepage__content-zone--top'
);
if ($banner_on) {
aksrt_homepage_render_system_module('banner', 'aksrt-homepage__content-zone aksrt-homepage__content-zone--banner aksrt-homepage__system-modules home-modules');
if ($banner_on && function_exists('aksrt_homepage_render_section')) {
aksrt_homepage_render_section('banner');
}
?>
<?php if ($main_list_enabled) : ?>
<section class="aksrt-homepage__stream" aria-label="<?php esc_attr_e('Homepage Content', 'aksrt'); ?>">
<div class="aksrt-homepage__stream-header">
<div class="aksrt-homepage__stream-intro">
<h2 class="aksrt-homepage__stream-title"><?php echo esc_html($list_title); ?></h2>
<p class="aksrt-homepage__stream-subtitle"><?php esc_html_e('以首页主内容流承接分类切换、排序与持续更新。', 'aksrt'); ?></p>
</div>
<?php if (function_exists('aksrt_render_admin_quick_link')) { aksrt_render_admin_quick_link('page-display/homepage', __('首页设置', 'aksrt'), 'aksrt-admin-quicklink aksrt-homepage__admin-link'); } ?>
</div>
<section class="aksrt-homepage__stream home-tab-content" aria-label="<?php esc_attr_e('Homepage Content', 'aksrt'); ?>">
<?php if ($show_tabs && !empty($tab_configs)) : ?>
<div class="aksrt-homepage__tabs home-tab-nav-box" data-sticky-tabs="<?php echo aksrt_homepage_sticky_tabs_enabled() ? 'true' : 'false'; ?>">
<ul class="aksrt-homepage__tab-list scroll-x no-scrollbar" role="tablist" data-aksrt-home-tabs>
<div class="index-tab affix-header-sm relative home-tab-nav-box aksrt-homepage__tabs mb10" data-sticky-tabs="<?php echo aksrt_homepage_sticky_tabs_enabled() ? 'true' : 'false'; ?>" offset-top="-8">
<ul class="aksrt-homepage__tab-list scroll-x no-scrollbar" role="tablist" data-aksrt-home-tabs style="width:100%;">
<li class="aksrt-homepage__tab-item is-active" role="presentation">
<button
type="button"
class="aksrt-homepage__tab-button"
role="tab"
aria-selected="true"
data-home-tab-target="latest"
>
<?php echo esc_html($list_title); ?>
<button type="button" class="aksrt-homepage__tab-button" role="tab" aria-selected="true" data-home-tab-target="latest">
<?php echo esc_html($list_title !== '' ? $list_title : __('最新发布', 'aksrt')); ?>
</button>
</li>
<?php foreach ($tab_configs as $tab_cfg) : ?>
@@ -876,29 +861,27 @@ if (!function_exists('aksrt_homepage_render_layout')) {
</li>
<?php endforeach; ?>
</ul>
<?php if (function_exists('aksrt_render_admin_quick_link')) { aksrt_render_admin_quick_link('page-display/homepage', __('首页设置', 'aksrt'), 'aksrt-admin-quicklink aksrt-homepage__admin-link'); } ?>
</div>
<?php elseif ($current_page > 1) : ?>
<div class="aksrt-homepage__titlebox">
<div class="box-body notop nobottom aksrt-homepage__titlebox">
<div class="title-theme">
<?php echo esc_html($list_title); ?>
<small class="aksrt-homepage__page-indicator">
<?php
echo esc_html(
sprintf(
__('第 %d 页', 'aksrt'),
$current_page
)
);
?>
<?php echo esc_html($list_title !== '' ? $list_title : __('最新发布', 'aksrt')); ?>
<small class="aksrt-homepage__page-indicator ml10">
<?php echo esc_html(sprintf(__('第 %d 页', 'aksrt'), $current_page)); ?>
</small>
</div>
</div>
<?php elseif ($list_title !== '') : ?>
<div class="box-body notop nobottom aksrt-homepage__titlebox">
<div class="title-theme"><?php echo esc_html($list_title); ?></div>
</div>
<?php endif; ?>
<?php aksrt_homepage_render_sortbar(); ?>
<div class="aksrt-homepage__panels tab-content home-tab-content">
<div class="aksrt-homepage__panel tab-pane is-active" role="tabpanel" data-home-tab-panel="latest">
<div class="aksrt-homepage__panels tab-content">
<div class="aksrt-homepage__panel posts-row ajaxpager tab-pane is-active" role="tabpanel" data-home-tab-panel="latest" id="index-tab-main">
<div
class="aksrt-homepage__panel-contract"
data-query-context="<?php echo esc_attr($latest_contract['query_context']); ?>"
@@ -913,7 +896,7 @@ if (!function_exists('aksrt_homepage_render_layout')) {
<?php if ($show_tabs && !empty($tab_configs)) : ?>
<?php foreach ($tab_configs as $tab_cfg) : ?>
<div
class="aksrt-homepage__panel tab-pane"
class="aksrt-homepage__panel ajaxpager tab-pane"
role="tabpanel"
data-home-tab-panel="term-<?php echo (int) $tab_cfg['term_id']; ?>"
data-tab-orderby="<?php echo esc_attr($tab_cfg['orderby']); ?>"
@@ -926,12 +909,10 @@ if (!function_exists('aksrt_homepage_render_layout')) {
<?php endif; ?>
<?php
aksrt_homepage_render_widget_zone(
['home_bottom_content'],
'aksrt-homepage__content-zone aksrt-homepage__content-zone--bottom'
);
?>
</div>