我使用自定义查询以一种相对复杂的方式完成了这项工作。我不知道是否重新加载了智能存档,所以我自己编写了代码。但这是可行的。将类别ID替换为“term\\u taxonomy.term\\u ID”
<?php
global $wpdb, $wp_locale;
$query = "select YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts from $wpdb->posts, $wpdb->term_taxonomy, $wpdb->term_relationships
WHERE $wpdb->posts.post_status = \'publish\'
AND $wpdb->posts.post_type = \'post\'
AND $wpdb->term_taxonomy.term_id = 11
AND $wpdb->posts.ID = $wpdb->term_relationships.object_id
AND $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id
GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC";
$arcresults = $wpdb->get_results($query);
foreach ($arcresults as $arcresult):
$text = sprintf(__(\'%1$s %2$d\'), $wp_locale->get_month($arcresult->month), $arcresult->year);?>
<li><a href="<?php bloginfo(\'url\') ?>/[your_category_base]/[your_category_name]/date/<?php echo $arcresult->year; ?>/<?php echo str_pad($arcresult->month, 2, \'0\', STR_PAD_LEFT); ?>"><?php echo $text; ?> </li>
<?php endforeach; ?>
写这篇文章的时候
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/general-template.php 其中定义了wp\\u get\\u归档。
并使用此处找到的代码(放入functions.php):http://snipplr.com/view.php?codeview&id=17432以以下形式为一个类别的存档创建永久链接http://example.com/category_base/category_name/date/YYYY/MM