Don’t use query_posts
in the template for simple modifications of the main query. Use the pre_get_posts
action instead to modify the query before it runs:
function wpa_date_posts_per_page( $query ) {
if ( !is_admin() && $query->is_date() && $query->is_main_query() ) {
$query->set( 'posts_per_page', 5 );
}
}
add_action( 'pre_get_posts', 'wpa_date_posts_per_page' );