Skip to content

Instantly share code, notes, and snippets.

@jkudish
Created February 8, 2012 03:56
Show Gist options
  • Save jkudish/1765214 to your computer and use it in GitHub Desktop.
Save jkudish/1765214 to your computer and use it in GitHub Desktop.
<?php
/**
* Filters the year dropdown in The Events Calendar plugin's grid view
* shows the current year isntead of the last 2
*
* @author Joachim Kudish @link http://jkudish.com
* @version 1.0
* @param (string) $yearOptions the number of years options string
* @return (string) $yearOptions the filtered number of years options string
*/
add_filter('tribe_month_year_dropdowns_yearOptions', 'tribe_filter_years');
function tribe_filter_years($yearOptions) {
$currentYearString = '<option value=\''.date('Y').'\' selected="selected">'.date('Y').'</option>';
$yearOptions = explode($currentYearString, $yearOptions);
return $currentYearString.$yearOptions[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment