It depends on how your archives.php
is designed.
You can use built-in wp_get_archives()
function to get posts for last 12 months:
<?php
wp_get_archives(
array(
'type' => 'monthly',
'limit' => 12
)
);
as described in the Codex.
Or you can modify the WP_Query
using 'date_query'
parameter:
<?php
$args = array(
'date_query' => array(
array(
'after' => strtotime("-1 year"), // a year before
'before' => strtotime("now");, // now
'inclusive' => true, // false to exclude first and last day
)
)
);
$query = new WP_Query( $args );
as also described there.