質問編集履歴

1

内容の追加

2017/09/29 04:32

投稿

sarisari
sarisari

スコア33

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,57 @@
47
47
 
48
48
 
49
49
  よろしくお願いいたします。
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ ---追加---
58
+
59
+
60
+
61
+ head.phpのphp構文が原因でした
62
+
63
+
64
+
65
+
66
+
67
+ ```
68
+
69
+ <?php $args = array(
70
+
71
+ 'post_type' => 'store' //投稿タイプの指定
72
+
73
+ );
74
+
75
+ $posts = get_posts( $args );
76
+
77
+ if( $posts ) : foreach( $posts as $post ) : setup_postdata( $post ); ?>
78
+
79
+
80
+
81
+ <li><a href="<?php the_permalink() ;?>"><?php the_title(); ?></a></li>
82
+
83
+
84
+
85
+ <?php endforeach; ?>
86
+
87
+ <?php else : //記事が無い場合 ?>
88
+
89
+ <li><p>記事はまだありません。</p></li>
90
+
91
+ <?php endif;
92
+
93
+ wp_reset_postdata(); //クエリのリセット ?>
94
+
95
+ ```
96
+
97
+
98
+
99
+ head.phpのメニューでstoreのタイトル、リンクを取得するためサブループを使用しておりますが、
100
+
101
+ これが原因のようでした。
102
+
103
+ 何故、このサブループが邪魔をしているのか、又改善策お願いいたします。