“is_new_day()” alternative for years?
You could create a helper function that returns a year number only once per year: function get_unique_year( $post_id = 0 ) { static $last = 0; $post_id || $post_id = get_the_ID(); $year = get_the_time( ‘Y’, $post_id ); if ( $year === $last ) return; $last = $year; return $last; } Then fetch your posts and … Read more