Files
wordpress-theme-aksrt/archive.php
T
kate522 9fd0735e97 清理 page-header 传参:主路径改 $args 契约
archive/search/page 不再用 aksrt_ph_* query-var 传参,
page.php 同步对齐 content-shell 主结构。
2026-07-09 22:57:37 +08:00

85 lines
2.7 KiB
PHP

<?php
/**
* Generic archive template.
*
* @package AKSRT
*/
defined('ABSPATH') || exit;
get_header();
global $wp_query;
$render_config = function_exists('aksrt_archive_get_render_config')
? aksrt_archive_get_render_config(['context' => 'archive'])
: ['context' => 'archive', 'mode' => 'card', 'card_style' => 'standard'];
$has_sidebar = function_exists('aksrt_archive_has_sidebar')
? aksrt_archive_has_sidebar()
: (function_exists('aksrt_is_show_sidebar') ? aksrt_is_show_sidebar() : false);
$archive_description = trim(wp_strip_all_tags((string) get_the_archive_description()));
$archive_summary = '';
if (is_author()) {
$author = get_queried_object();
if ($author instanceof WP_User) {
$archive_summary = sprintf(__('作者:%s', 'aksrt'), $author->display_name);
}
} elseif ($archive_description !== '') {
$archive_summary = $archive_description;
} elseif (isset($wp_query->found_posts)) {
$archive_summary = sprintf(
esc_html(_n('共 %d 篇内容', '共 %d 篇内容', (int) $wp_query->found_posts, 'aksrt')),
(int) $wp_query->found_posts
);
}
if (function_exists('aksrt_archive_open_shell')) {
aksrt_archive_open_shell([
'main_class' => 'site-main content-shell content-shell--stream',
'has_sidebar' => $has_sidebar,
'page_kind' => 'archive',
]);
} else {
echo '<main id="main-content" class="site-main content-shell content-shell--stream" tabindex="-1"><div class="content-wrap"><div class="content-layout' . ($has_sidebar ? '' : ' content-layout--no-sidebar') . '"><div class="content-layout__primary">';
}
?>
<div class="content-main content-main--archive">
<?php if (function_exists('aksrt_breadcrumbs')) { aksrt_breadcrumbs(); } ?>
<?php
ob_start();
if (function_exists('aksrt_render_admin_quick_link')) {
aksrt_render_admin_quick_link('post-list/list', __('列表样式设置', 'aksrt'));
}
$admin_link = trim((string) ob_get_clean());
get_template_part('templates/parts/page-header', null, [
'eyebrow' => __('内容归档', 'aksrt'),
'title' => get_the_archive_title(),
'desc' => $archive_summary,
'extra' => $admin_link,
]);
?>
<?php
if (function_exists('aksrt_archive_render_stream')) {
aksrt_archive_render_stream(null, $render_config, [
'page_kind' => 'archive',
'query_context' => 'archive',
'stream_class' => 'content-stream--archive',
'empty_text' => __('暂无文章', 'aksrt'),
]);
}
?>
</div>
<?php
if (function_exists('aksrt_archive_close_shell')) {
aksrt_archive_close_shell(['has_sidebar' => $has_sidebar]);
} else {
echo '</div>';
if ($has_sidebar) { get_sidebar(); }
echo '</div></div></main>';
}
get_footer();