質問編集履歴

1

詳細

2017/05/17 16:21

投稿

kenkbou
kenkbou

スコア151

test CHANGED
File without changes
test CHANGED
@@ -43,3 +43,37 @@
43
43
 
44
44
 
45
45
  よろしくお願いします。
46
+
47
+
48
+
49
+ 追記
50
+
51
+ ```single-AAA.php
52
+
53
+ <?php
54
+
55
+ while ( have_posts() ) : the_post();
56
+
57
+ get_template_part( 'template-parts/content', 'single' );
58
+
59
+ endwhile;
60
+
61
+ ?>
62
+
63
+ ```
64
+
65
+ ```template-parts/content-single.php
66
+
67
+ <?php
68
+
69
+ $post = get_post(get_the_ID()); // $post->IDは取得出来ている
70
+
71
+ $category_id = $post->category; // categoryIDは取得出来ている
72
+
73
+ $cat = get_the_category($post->ID);
74
+
75
+ var_dump($cat); // null
76
+
77
+ exit();
78
+
79
+ ```