我认为最简单的方法是使用get_archives_link filter. 例如:
add_filter (\'get_archives_link\',
function ($link_html, $url, $text, $format, $before, $after) {
if (\'with_plus\' == $format) {
$link_html = "<li class=\'CAPS source-bold\'><a href=\'$url\'>"
. "<span class=\'plus\'>+</span> Trip $text"
. \'</a></li>\';
}
return $link_html;
}, 10, 6);
然后,在模板中:
<?php wp_get_archives ([\'type\' => \'yearly\', \'format\' => \'with_plus\']) ?>