回答編集履歴
1
追記
answer
CHANGED
@@ -9,4 +9,20 @@
|
|
9
9
|
|
10
10
|
参考URL
|
11
11
|
- [https://wpdocs.osdn.jp/テンプレートタグ/get_posts](https://wpdocs.osdn.jp/%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88%E3%82%BF%E3%82%B0/get_posts)
|
12
|
-
- [http://wpdocs.osdn.jp/関数リファレンス/get_children](http://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/get_children)
|
12
|
+
- [http://wpdocs.osdn.jp/関数リファレンス/get_children](http://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/get_children)
|
13
|
+
|
14
|
+
----
|
15
|
+
|
16
|
+
とりあえず、こんな感じでエラーは出ないと思います。
|
17
|
+
|
18
|
+
```PHP
|
19
|
+
$myposts = get_posts('posts_per_page' => -1);
|
20
|
+
foreach($myposts as $post){
|
21
|
+
setup_postdata( $post );
|
22
|
+
the_title();
|
23
|
+
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment' );
|
24
|
+
foreach( (array) $images as $attach_id => $attach ){
|
25
|
+
echo wp_get_attachment_link( $attach_id );
|
26
|
+
}
|
27
|
+
}
|
28
|
+
```
|