回答編集履歴
3
追記
test
CHANGED
@@ -13,3 +13,43 @@
|
|
13
13
|
WordPress ループ&クエリーのモヤモヤを解消しよう! | wpxtreme
|
14
14
|
|
15
15
|
[http://wpxtreme.jp/understanding-wordpress-loops-and-queries](http://wpxtreme.jp/understanding-wordpress-loops-and-queries)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
----
|
20
|
+
|
21
|
+
【追記2】
|
22
|
+
|
23
|
+
問題が再現できないので分かりませんが下記コードのように`$post`も避けた方が解決するかもしれません
|
24
|
+
|
25
|
+
```PHP
|
26
|
+
|
27
|
+
<span class="top_postlist_date">♦NEWS</span><br />
|
28
|
+
|
29
|
+
<?php
|
30
|
+
|
31
|
+
$args = array(
|
32
|
+
|
33
|
+
'posts_per_page' => 3
|
34
|
+
|
35
|
+
);
|
36
|
+
|
37
|
+
$myposts = get_posts( $args );
|
38
|
+
|
39
|
+
foreach ( $myposts as $mypost ):
|
40
|
+
|
41
|
+
?>
|
42
|
+
|
43
|
+
<li id="su-post-<?php echo $mypost->ID; ?>" class="su-post">
|
44
|
+
|
45
|
+
<a href="<?php the_permalink($mypost->ID); ?>"><span class="top_postlist_date"><?php echo get_the_time('Y/m/d', $mypost->ID); ?></span><?php echo $mypost->post_title; ?></a>
|
46
|
+
|
47
|
+
</li>
|
48
|
+
|
49
|
+
<?php
|
50
|
+
|
51
|
+
endforeach;
|
52
|
+
|
53
|
+
?>
|
54
|
+
|
55
|
+
```
|
2
追記
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
----
|
6
6
|
|
7
|
-
|
7
|
+
【追記】
|
8
8
|
|
9
9
|
回答が被ってしまったのでなぜ`$posts`を使用してはいけないかを解説している参考リンクを置いておきます
|
10
10
|
|
1
追記
test
CHANGED
@@ -1 +1,15 @@
|
|
1
1
|
`$posts`は予約されている変数名なので一意のものに変更してください。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
----
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
回答が被ってしまったのでなぜ`$posts`を使用してはいけないかを解説している参考リンクを置いておきます
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
WordPress ループ&クエリーのモヤモヤを解消しよう! | wpxtreme
|
14
|
+
|
15
|
+
[http://wpxtreme.jp/understanding-wordpress-loops-and-queries](http://wpxtreme.jp/understanding-wordpress-loops-and-queries)
|