カレンダーの土日日付を色づけする
この記事は2010/11/30に公開され2012/01/09に更新、724回読まれました。
wp-includes/general-template.phpを直接編集する。
本来はthemes/functions.phpで対応したいところだけど。
- if ( $day == gmdate(‘j’, current_time(‘timestamp’)) && $thismonth == gmdate(‘m’, current_time(‘timestamp’)) && $thisyear == gmdate(‘Y’, current_time(‘timestamp’)) )
- $calendar_output .= ‘<td id=”today”>’;
- /*Sunday Saturday Color*/
- else
- if ( calendar_week_mod(date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear))) % 7 == 0 ) {
- $calendar_output .= ‘ ‘;
- }
- elseif ( calendar_week_mod(date(‘w’, mktime(0, 0 , 0, $thismonth, $day, $thisyear))) % 7 == 6 ) {
- $calendar_output .= ‘ ‘;
- }
- /*Sunday Saturday Color*/
- else
- $calendar_output .= ‘<td>’;
これで土日にそれぞれ.sunday、.saturdayというクラスがつくので、スタイルシートで色を指定します。
コメントする