質問編集履歴
1
コードを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,6 +4,38 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
+
```PHP
|
8
|
+
|
9
|
+
$target_day1 = '2016/11/01';
|
10
|
+
|
11
|
+
$target_day2 = '2016/12/31';
|
12
|
+
|
13
|
+
if (get_the_date() > $target_day1) {
|
14
|
+
|
15
|
+
echo '<link rel="stylesheet" href="http://localhost/wp-content/themes/test/red.css" type="text/css" media="all" />';
|
16
|
+
|
17
|
+
}elseif (get_the_date() < $target_day2) {
|
18
|
+
|
19
|
+
echo '<link rel="stylesheet" href="http://localhost/wp-content/themes/test/red.css" type="text/css" media="all" />';
|
20
|
+
|
21
|
+
}else{
|
22
|
+
|
23
|
+
//どちらにも該当しない場合、処理しない
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
11月1日以降であればCSSを適応する。
|
32
|
+
|
33
|
+
そうじゃなければ、12月31日未満であれば適応しない。
|
34
|
+
|
35
|
+
それも違えば何もしないと記述したのですが、よくよく考えれば、day1〜day2の内という指定がないので永年ずっと出てしまう現象です。
|
36
|
+
|
37
|
+
|
38
|
+
|
7
39
|
参考にしたサイトがこちらです。
|
8
40
|
|
9
41
|
[http://pluswordpress.com/get_the_date/](http://pluswordpress.com/get_the_date/)
|