如果想將星期六和日以不同顏色顯示只需要加多一個樣式進入 CSS
- 先打開 wp-content/themes/{模版}/style.css 加入
1 2 3
| #wp-calendar .holiday { color: red; }
|
- 之後打開 wp-includes/general-template.php 找
1 2 3 4
| if ( $day == gmdate('j', (time() + (get_option('gmt_offset') * 3600))) && $thismonth == gmdate('m', time()+(get_option('gmt_offset') * 3600)) && $thisyear == gmdate('Y', time()+(get_option('gmt_offset') * 3600)) ) echo '<td id="today">'; else echo '<td>';
|
在下面加入
1 2 3 4 5 6 7
| if ( 6 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins) ) { $tmp_day = "<span class=\"holiday\">$day</span>"; }elseif (0 == calendar_week_mod(date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))-$week_begins)) { $tmp_day = "<span class=\"holiday\">$day</span>"; }else{ $tmp_day = $day; }
|
之後再找
1 2 3 4 5
| if ( in_array($day, $daywithpost) ) echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$day</a>"; else echo $day; echo '</td>';
|
取代為
1 2 3 4 5
| if ( in_array($day, $daywithpost) ) echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\" title=\"$ak_titles_for_day[$day]\">$tmp_day</a>"; else echo $tmp_day; echo '</td>';
|
- 保存並上載