質問編集履歴

8

詳細を更新

2018/07/18 00:55

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -66,9 +66,9 @@
66
66
 
67
67
  ---
68
68
 
69
- taxonomy-area.phpで以下を記述
69
+ taxonomy-area.phpで以下を記述してみる
70
70
 
71
- ↓「紐づいているタームによる絞り込み」がうまく動作せず(条件と一致しない"animal"の一覧が表示される)
71
+ ↓「紐づいているタームによる絞り込み」がうまく動作せず(postがある"animal"の一覧が表示される)
72
72
 
73
73
  ```php
74
74
 
@@ -90,7 +90,7 @@
90
90
 
91
91
  ),
92
92
 
93
-
93
+ 'number' => 5
94
94
 
95
95
  );
96
96
 

7

不明瞭だった箇所を修正

2018/07/18 00:55

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
@@ -1 +1 @@
1
- taxonomy-X.phpにおいて、ACFで作成したタームのフィールド値を基紐づくターム一覧を表示したい
1
+ タームに紐づくターム一覧を表示したい
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- 今回、各ターム(地域)に、「生息地域」として、当該「area」に紐づいているタクソノミー「animal」のターム一覧をリンク付きで表示させたいと思っています。
49
+ 今回、各ターム(地域)に、「生息地域」として、当該「area」に紐づいているタクソノミー「animal」のターム一覧をリンク付きで表示させたいと思っています。表示場所はtaxonomy-area.phpです。
50
50
 
51
51
 
52
52
 
@@ -65,6 +65,8 @@
65
65
  **試したこと**
66
66
 
67
67
  ---
68
+
69
+ taxonomy-area.phpで以下を記述
68
70
 
69
71
  ↓「紐づいているタームによる絞り込み」がうまく動作せず(条件と一致しない"animal"の一覧が表示される)
70
72
 

6

試したことの修正

2018/07/18 00:52

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -66,7 +66,7 @@
66
66
 
67
67
  ---
68
68
 
69
- ↓「紐づいているタームによる絞り込み」がうまく動作せず
69
+ ↓「紐づいているタームによる絞り込み」がうまく動作せず(条件と一致しない"animal"の一覧が表示される)
70
70
 
71
71
  ```php
72
72
 

5

「試したこと」の詳細記載

2018/07/11 03:37

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -66,6 +66,8 @@
66
66
 
67
67
  ---
68
68
 
69
+ ↓「紐づいているタームによる絞り込み」がうまく動作せず
70
+
69
71
  ```php
70
72
 
71
73
  <?php $area = get_query_var('term');?>

4

試したことの修正

2018/07/08 00:37

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -68,7 +68,7 @@
68
68
 
69
69
  ```php
70
70
 
71
- <? $area = get_query_var('term');?>
71
+ <?php $area = get_query_var('term');?>
72
72
 
73
73
  <ul><?php
74
74
 

3

試したことの修正

2018/07/07 02:30

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -96,8 +96,6 @@
96
96
 
97
97
  $term_link = get_term_link($term->slug,'animal');
98
98
 
99
- ?><li><a href="<?php echo $term_link; ?>"><?php echo $term->name; ?></a></li><?php
99
+ ?><li><a href="<?php echo $term_link; ?>"><?php echo $term->name; ?></a></li></ul>
100
-
101
- } ?></ul>
102
100
 
103
101
  ```

2

試したことの修正

2018/07/07 02:29

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,7 @@
94
94
 
95
95
  foreach($the_query->get_terms() as $term){
96
96
 
97
- $term_link = get_term_link($term->slug,'area');
97
+ $term_link = get_term_link($term->slug,'animal');
98
98
 
99
99
  ?><li><a href="<?php echo $term_link; ?>"><?php echo $term->name; ?></a></li><?php
100
100
 

1

試したことの追加

2018/07/07 02:27

投稿

JG1QOW
JG1QOW

スコア15

test CHANGED
File without changes
test CHANGED
@@ -55,3 +55,49 @@
55
55
  ご教授いただける方がおられましたら、お力添えいただければ幸いです。
56
56
 
57
57
  宜しくお願いいたします。
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+ **試したこと**
66
+
67
+ ---
68
+
69
+ ```php
70
+
71
+ <? $area = get_query_var('term');?>
72
+
73
+ <ul><?php
74
+
75
+ $args = array(
76
+
77
+ 'taxonomy' => 'animal',
78
+
79
+ 'tax_query' => array(
80
+
81
+ 'taxonomy' => 'area',
82
+
83
+ 'field' => 'slug',
84
+
85
+ 'terms' => $area
86
+
87
+ ),
88
+
89
+
90
+
91
+ );
92
+
93
+ $the_query = new WP_Term_Query($args);
94
+
95
+ foreach($the_query->get_terms() as $term){
96
+
97
+ $term_link = get_term_link($term->slug,'area');
98
+
99
+ ?><li><a href="<?php echo $term_link; ?>"><?php echo $term->name; ?></a></li><?php
100
+
101
+ } ?></ul>
102
+
103
+ ```