Retrieve Last Year Archives Only

This snippet retrieves and echoes only last year archives. It could be useful if you want to make collapsing/expanding archives by year.

Just inserts this snippet in your theme where you want to display archives.
You might want to tune the wp_get_archives options as you want!

Code Snippet:

function filter_last_year_archives($where_clause) {
	$year = date('Y') - 1;
    	return $where_clause." AND post_date LIKE '%".$year."%'";

Posted in Posts