Align main shells to main.container > .content-wrap + .sidebar siblings, drop content-shell padding on dual-column hosts, and remove route flex overrides that disabled the negative-margin sidebar math.
85 lines
2.5 KiB
PHP
85 lines
2.5 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' => 'list'];
|
|
$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 container',
|
|
'has_sidebar' => $has_sidebar,
|
|
'page_kind' => 'archive',
|
|
]);
|
|
} else {
|
|
echo '<main id="main-content" class="site-main container" tabindex="-1"><div class="content-wrap"><div class="content-layout">';
|
|
}
|
|
?>
|
|
<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></div>';
|
|
if ($has_sidebar) { get_sidebar(); }
|
|
echo '</main>';
|
|
}
|
|
|
|
get_footer();
|