节选了wp_get_archives内部的一段代码 参数中支持设定year
function wp_get_archives( $args = '' ) {
global $wpdb, $wp_locale;
$defaults = array(
'type' => 'monthly',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
'order' => 'DESC',
'post_type' => 'post',
'year' => get_query_var( 'year' ),
'monthnum' => get_query_var( 'monthnum' ),
'day' => get_query_var( 'day' ),
'w' => get_query_var( 'w' ),
);
查了下可能不是想要的效果 考虑通过getarchives_where函数实现吧:
https://wordpress.stackexchange. ... ith-wp-get-archives
|