专用页对齐 content-shell,并删 page-header query-var 回退
archives/friends/newposts/posts-navs/categories 统一壳层与 page-header 契约, 主路径不再保留 aksrt_ph_* ambient 传参。
This commit is contained in:
1 parent
9fd0735e97
commit
8849540fda
6 files changed
+228
-210
No files matched your search
@@ -12,57 +12,64 @@ defined('ABSPATH') || exit;
|
||||
|
||||
get_header();
|
||||
global $wpdb;
|
||||
|
||||
if (function_exists('aksrt_archive_open_shell')) {
|
||||
aksrt_archive_open_shell([
|
||||
'main_class' => 'site-main container content-shell content-shell--page page-content-default',
|
||||
'has_sidebar' => false,
|
||||
'page_kind' => 'archives',
|
||||
]);
|
||||
}
|
||||
?>
|
||||
<div class="content-main content-main--page content-main--archives">
|
||||
<?php
|
||||
get_template_part('templates/parts/page-header', null, [
|
||||
'title' => esc_html__('文章归档', 'aksrt'),
|
||||
]);
|
||||
?>
|
||||
|
||||
<main id="main-content" class="container page-content-default" tabindex="-1">
|
||||
<header class="page-header">
|
||||
<h1 class="entry-title"><?php esc_html_e('文章归档', 'aksrt'); ?></h1>
|
||||
</header>
|
||||
|
||||
<div class="content-wrap">
|
||||
<div class="content-layout content-layout--no-sidebar">
|
||||
<div class="content-layout__primary">
|
||||
<div class="aksrt-archives container">
|
||||
<?php
|
||||
$years = $wpdb->get_results(
|
||||
"SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, COUNT(*) AS count
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = 'post' AND post_status = 'publish'
|
||||
GROUP BY YEAR(post_date), MONTH(post_date)
|
||||
ORDER BY year DESC, month DESC"
|
||||
); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
|
||||
$current_year = 0;
|
||||
foreach ($years as $row) :
|
||||
if ((int) $row->year !== $current_year) :
|
||||
$current_year = (int) $row->year;
|
||||
?>
|
||||
<h2 class="aksrt-archives__year"><?php echo esc_html($current_year); ?></h2>
|
||||
<?php endif; ?>
|
||||
<h3 class="aksrt-archives__month">
|
||||
<?php echo esc_html(sprintf('%d 月 (%d 篇)', (int) $row->month, (int) $row->count)); ?>
|
||||
</h3>
|
||||
<ul class="aksrt-archives__list">
|
||||
<?php
|
||||
$month_posts = get_posts([
|
||||
'year' => (int) $row->year,
|
||||
'monthnum' => (int) $row->month,
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'publish',
|
||||
]);
|
||||
foreach ($month_posts as $mp) :
|
||||
?>
|
||||
<li class="aksrt-archives__item">
|
||||
<span class="aksrt-archives__date"><?php echo esc_html(get_the_date('m-d', $mp)); ?></span>
|
||||
<a href="<?php echo esc_url(get_permalink($mp->ID)); ?>" class="aksrt-archives__link"><?php echo esc_html($mp->post_title); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<div class="aksrt-archives">
|
||||
<?php
|
||||
$years = $wpdb->get_results(
|
||||
"SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, COUNT(*) AS count
|
||||
FROM {$wpdb->posts}
|
||||
WHERE post_type = 'post' AND post_status = 'publish'
|
||||
GROUP BY YEAR(post_date), MONTH(post_date)
|
||||
ORDER BY year DESC, month DESC"
|
||||
); // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
|
||||
$current_year = 0;
|
||||
foreach ($years as $row) :
|
||||
if ((int) $row->year !== $current_year) :
|
||||
$current_year = (int) $row->year;
|
||||
?>
|
||||
<h2 class="aksrt-archives__year"><?php echo esc_html((string) $current_year); ?></h2>
|
||||
<?php endif; ?>
|
||||
<h3 class="aksrt-archives__month">
|
||||
<?php echo esc_html(sprintf('%d 月 (%d 篇)', (int) $row->month, (int) $row->count)); ?>
|
||||
</h3>
|
||||
<ul class="aksrt-archives__list">
|
||||
<?php
|
||||
$month_posts = get_posts([
|
||||
'year' => (int) $row->year,
|
||||
'monthnum' => (int) $row->month,
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => 'publish',
|
||||
]);
|
||||
foreach ($month_posts as $mp) :
|
||||
?>
|
||||
<li class="aksrt-archives__item">
|
||||
<span class="aksrt-archives__date"><?php echo esc_html(get_the_date('m-d', $mp)); ?></span>
|
||||
<a href="<?php echo esc_url(get_permalink($mp->ID)); ?>" class="aksrt-archives__link"><?php echo esc_html($mp->post_title); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (function_exists('aksrt_archive_close_shell')) {
|
||||
aksrt_archive_close_shell(['has_sidebar' => false]);
|
||||
}
|
||||
|
||||
get_footer();
|
||||
Reference in new issue
Block a user