質問編集履歴

1

解決した補足を追記

2017/06/29 08:18

投稿

seiji_maemura
seiji_maemura

スコア129

test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,37 @@
21
21
  出来れば、スラッグを工夫するなどの投稿ルールで行うのではなく、簡易に親記事・子記事のURL(パーマリンク)を取得する方法がありましたら、ご教示いただけますでしょうか。
22
22
 
23
23
  よろしくお願いいたします。
24
+
25
+
26
+
27
+ ###補足
28
+
29
+ yukikpさんにいただいたヒントを元に、いろいろ探して下記サイトを見つけました。掲載されているソースをカスタマイズしたら出せるようになりました。
30
+
31
+ 参考サイト:http://yotsuba-d.com/blog/post-6246/
32
+
33
+ ```php
34
+
35
+ $child_posts = query_posts( array(
36
+
37
+ 'numberposts' => -1,
38
+
39
+ 'order' => ASC,
40
+
41
+ 'orderby' => post_title,
42
+
43
+ 'post_type' => get_post_type(),
44
+
45
+ 'post_parent' => $post->ID, ));
46
+
47
+ foreach ( $child_posts as $child ) {
48
+
49
+ $child_posttitle = apply_filters( 'the_title', $child->post_title );
50
+
51
+ $child_permalink = apply_filters( 'the_permalink', get_permalink( $child->ID ) );
52
+
53
+ }
54
+
55
+ wp_reset_postdata(); ?>
56
+
57
+ ```