質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -45,3 +45,63 @@
|
|
45
45
|
どのように書けばよいでしょうか。。
|
46
46
|
|
47
47
|
お力お貸しいただけますと幸いです。
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
追記しました。
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
前後ですが、余分なコードをすべて消した
|
56
|
+
|
57
|
+
以下のようなsingle.phpでも結果は同じです。。
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
```php
|
62
|
+
|
63
|
+
<?php
|
64
|
+
|
65
|
+
get_header();
|
66
|
+
|
67
|
+
?>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<?php while ( have_posts() ) : the_post(); ?>
|
72
|
+
|
73
|
+
<?php
|
74
|
+
|
75
|
+
$last_post_ids = array();
|
76
|
+
|
77
|
+
$lastposts = get_posts('posts_per_page=5&orderby=modified');
|
78
|
+
|
79
|
+
foreach($lastposts as $lastpost) {
|
80
|
+
|
81
|
+
$last_post_ids[] = $lastpost->ID;
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
?>
|
86
|
+
|
87
|
+
<?php if ( in_array( $post->ID, $last_post_ids ) ) : ?>New<?php endif; ?>
|
88
|
+
|
89
|
+
<?php endwhile; ?>
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<?php get_footer(); ?>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
orderby=modifiedを除けば、投稿順での新着になら動作するのですが、、
|
100
|
+
|
101
|
+
コード自体には問題ないとのことなのですが、
|
102
|
+
|
103
|
+
他に何か考えられる原因はござますでしょうか。。
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
お手数おかけして申し訳ございません。
|