Created
April 12, 2012 22:54
Revisions
-
codearachnid created this gist
Apr 12, 2012 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ <?php /** * The issue is in lib/tribe-view-helpers.class.php and exists in the getMonthOptions function. * The date that is passed in by default "2012-04-01-01" has an extra '-01' appended to it. * I am unsure where this is getting added to the date, but adding str_replace( '01-01', '01', $date ) * to remove those extra characters fixes the output. */ /** * Builds a set of options for displaying a month chooser * @param string the current date to select (optional) * @return string a set of HTML options with all months (current month selected) */ public static function getMonthOptions($date = "") { $tribe_ecp = TribeEvents::instance(); $months = $tribe_ecp->monthNames(); $options = ''; if (empty($date)) { $month = ( date_i18n('j') == date_i18n('t') ) ? date('F', time() + 86400) : date_i18n('F'); } else { // get rid of extra -01 $date = str_replace( '01-01', '01', $date ); $month = date('F', strtotime($date)); } $monthIndex = 1; foreach ($months as $englishMonth => $monthText) { if ($monthIndex < 10) { $monthIndex = "0" . $monthIndex; // need a leading zero in the month } if ($month == $englishMonth) { $selected = 'selected="selected"'; } else { $selected = ''; } $options .= "<option value='$monthIndex' $selected>$monthText</option>\n"; $monthIndex++; } return $options; }