[Tip]WordPress 달력 색 입히기.(Ver.2.84 이하)

일반 달력에서 보는 것처럼 ‘일요일‘은 빨간색으로 입혀보자. ㅋ

관련 문서는 Robin’s Blog님의 블로그에서 참고 했음.

1. general-template.php 파일을 연다.

1037
1038
1039
1040
1041
1042
1043
foreach ( $myweek as $wd ) {
  $day_name = (true == $initial) ? $wp_locale->get_weekday_initial($wd) : $wp_locale->
 get_weekday_abbrev($wd);echo "\n\t\t
<th title=\"$wd\" scope=\"col\"> </th>
 
  $day_name";
}

1037번을 아래와 같이 변경.

1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
	if ($wd == "Sunday")
	echo "\n\t\t
<th id=\"sun\" abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>
 
";
	else
	echo "\n\t\t
<th abbr=\"$wd\" scope=\"col\" title=\"$wd\">$day_name</th>
 
";
}

그 다음에는 1130번째 줄을 찾아서.

1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
 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"> </td>
 
';
  else
    echo '
<td> </td>
 
';

위와 같이 되어 있는 것을 아래와 같이 바꿔준다.

1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
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">';
elseif ( date('D', mktime(0, 0, 0, $thismonth, $day, $thisyear) )  == "Sun")
	echo '</td>
<td id="sun">';
else
	echo '</td>
<td>';
</td>

마지막으로 , 스타일 시트를 수정한다. ( 제 테마에서는 style.css 입니다.)

#wp-calendar #sun {
	color:#fe3614;
}

이상 끝!

자료

Be Sociable, Share!

관련 포스트

About Gyuuuuu~*

Twitter: @gyu7e "사람은 누구나 자신의 인생을 살 권리가 있다"
This entry was posted in 분류되지 않음 and tagged , , , , , , , , . Bookmark the permalink.

Comments are closed.