I recommend to hook into the pre_get_posts() function to change the query by adding this code to your functions.php file:
<?php
function filter_by_date( $query ) {
if ( ! is_admin() && $query->is_main_query() ) {
if ( isset( $_GET['year'] ) ) {
$query->set( 'year', $_GET['year'] );
$query->set( 'post_type', 'events' );
}
}
return $query;
}
add_action( 'pre_get_posts', 'filter_by_date' );
?>