質問編集履歴

3

文字修正

2021/03/13 13:38

投稿

pontas
pontas

スコア54

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  'post_type' => 'test',
48
48
 
49
- 'category' => $category_ID,
49
+ 'category__in' => $category_ID,
50
50
 
51
51
  'posts_per_page' => -1,
52
52
 

2

文字修正

2021/03/13 13:38

投稿

pontas
pontas

スコア54

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,19 @@
24
24
 
25
25
  ```ここに言語名を入力
26
26
 
27
+ <?php
28
+
27
- <?php $categories = get_the_category();?>
29
+ $categories = get_the_category();
30
+
31
+ $category_ID = array();
32
+
33
+ foreach($categories as $category):
34
+
35
+ array_push( $category_ID, $category -> cat_ID);
36
+
37
+ endforeach
38
+
39
+ ?>
28
40
 
29
41
  <?php
30
42
 
@@ -34,7 +46,7 @@
34
46
 
35
47
  'post_type' => 'test',
36
48
 
37
- 'category' => array($categories->term_id),
49
+ 'category' => $category_ID,
38
50
 
39
51
  'posts_per_page' => -1,
40
52
 

1

誤字

2021/03/13 13:37

投稿

pontas
pontas

スコア54

test CHANGED
File without changes
test CHANGED
@@ -34,7 +34,7 @@
34
34
 
35
35
  'post_type' => 'test',
36
36
 
37
- 'category' => $categories->term_id,
37
+ 'category' => array($categories->term_id),
38
38
 
39
39
  'posts_per_page' => -1,
40
40