';
// 顶部:年份标题 + 四角导航上排
$out .= '
';
/* 🔴 年份标题同样**不能**过 number_format_i18n(会变「2,025」)。
* 而且要输出纯数字,与 JS 切年后的 `String(year)` 完全一致 ——
* 两边不一致就是「首屏 2,025、点一下 2025」。 */
$out .= '
'
. esc_html((string) $year) . '
';
$out .= ''
. sprintf(
/* translators: %s: 文章数 */
esc_html__('共 %s 篇', 'kratos'),
esc_html(number_format_i18n($data['years'][$year]['count']))
)
. '';
if ($opt['nav']) {
$out .= yang_archives_render_nav($year, $data['order'], 'top');
}
$out .= '';
// 列表主体
$out .= '
';
$out .= yang_archives_render_year($data['years'][$year], $year, $opt['month']);
$out .= '
';
// 底部导航(四角的下排)
if ($opt['nav']) {
$out .= '';
}
$out .= '';
$out .= '
';
return $out;
}
/* 🔴🔴 WP 的 shortcode 标签**区分大小写** —— 这一点 3.2.46 写错过,实测过。
*
* 内核证据(wp-includes/shortcodes.php):
* ① `get_shortcode_regex()` 直接 `implode('|', array_map('preg_quote', $tagnames))`,
* 拿注册名拼正则,**没有做任何大小写归一化**;
* ② `do_shortcode()` 里 `preg_match_all('/' . get_shortcode_regex() . '/', ...)`
* —— 修饰符只有默认,**没有 `i`**;
* ③ `do_shortcode_tag()` 拿到 `$tag = $m[2]` 后直接 `$shortcode_tags[$tag]` 精确查表。
*
* ⇒ `add_shortcode('archives', ...)` **只匹配全小写 `[archives]`**。
* 用户按文档写 `[Archives]`,正则压根不认,WordPress 就把原文原样吐出来
* —— 页面显示 `