質問編集履歴

5

追記

2016/06/29 06:04

投稿

tokiodeluxe
tokiodeluxe

スコア18

test CHANGED
File without changes
test CHANGED
@@ -92,7 +92,17 @@
92
92
 
93
93
 
94
94
 
95
+ 【追記】
95
96
 
97
+ 自分自身、やりたいことと、伝え方がまとまっておらず申し訳ございませんでした。
98
+
99
+ 「投稿」に「ターム」が設定されており、
100
+
101
+ 1つめの投稿には「ターム」のaaaaを、2つめの投稿には「ターム」のbbbbを選択し後悔しております。
102
+
103
+ このタームaaaaの一覧を表示するため上記コードを入力し、
104
+
105
+ term->nameで一覧が表示されるようにはなりましたが、この「term->name」を少しさわればその投稿のアイキャッチが取得できるのではないかと思われるのですが、手が止まってしまいました。
96
106
 
97
107
 
98
108
 

4

アイキャッチ画像表示など、追記

2016/06/29 06:04

投稿

tokiodeluxe
tokiodeluxe

スコア18

test CHANGED
File without changes
test CHANGED
@@ -78,6 +78,30 @@
78
78
 
79
79
 
80
80
 
81
+ 【追記】
82
+
83
+ プラグインのCPT UIで「イベント」というものを作成し、「ques」というタクソノミーを「イベント」に作成しました。
84
+
85
+ その追加された「ques」に「aaaa」と「bbbb」というスラッグを作成しました。
86
+
87
+ 「イベント」の新規作成を行い、「aaaa」スラッグに設定を行い、アイキャッチの設定も行いました(画像参照
88
+
89
+ このスラッグに該当するアイキャッチ画像を取得したく思います。
90
+
91
+ ![イメージ説明](c5d36edd7e2368371503028f6782a0b6.png)
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
81
105
 
82
106
 
83
107
  調べれば出てくるような内容ではあるのでしょうが、私ひとりでは解決に至らなかったため

3

リンクの修正

2016/06/29 05:27

投稿

tokiodeluxe
tokiodeluxe

スコア18

test CHANGED
File without changes
test CHANGED
@@ -64,7 +64,7 @@
64
64
 
65
65
  参考にしたのは、
66
66
 
67
- [http://webcake.no003.info/webdesign/get-terms.html]
67
+ [http://webcake.no003.info/webdesign/get-terms.html](http://webcake.no003.info/webdesign/get-terms.html)
68
68
 
69
69
  のページになります。
70
70
 

2

コードブロック、リンクの追加をしました

2016/06/29 00:58

投稿

tokiodeluxe
tokiodeluxe

スコア18

test CHANGED
File without changes
test CHANGED
@@ -14,55 +14,57 @@
14
14
 
15
15
  /****page.php****/
16
16
 
17
+
18
+
19
+ ```ここに言語を入力
20
+
17
21
  <?php
18
22
 
19
- // カスタム分類名
23
+ // カスタム分類名
20
24
 
21
- $taxonomy = 'artists';
25
+ $taxonomy = 'artists';
26
+
27
+ // カスタム分類のタームのリストを取得
28
+
29
+ $terms = get_terms( $taxonomy , array('child_of'=>180));
22
30
 
23
31
 
24
32
 
25
- // カスム分類のタームのリストを取得
33
+ // タームのリスト $terms $term に格納してループ
26
34
 
27
- $terms = get_terms( $taxonomy , array('child_of'=>180));
35
+ foreach ( $terms as $term ) {
28
36
 
29
-
37
+ // タームのURLを取得
30
38
 
31
- // タームのリスト $terms $term に格納してループ
39
+ $term = sanitize_term( $term, $taxonomy );
32
40
 
33
- foreach ( $terms as $term ) {
41
+ $term_link = get_term_link( $term, $taxonomy );
34
42
 
35
-
43
+ if ( is_wp_error( $term_link ) ) {
36
44
 
37
- // タームのURLを取得
45
+ continue;
38
46
 
39
- $term = sanitize_term( $term, $taxonomy );
47
+ }
40
48
 
41
- $term_link = get_term_link( $term, $taxonomy );
49
+ // タームのURLと名称を出力
42
50
 
43
- if ( is_wp_error( $term_link ) ) {
51
+ echo '<p><a href="' . esc_url( $term_link ) . '">' . $term->name;
44
52
 
45
- continue;
53
+ echo '</a></p>';
46
54
 
47
- }
55
+ }
48
-
49
-
50
-
51
- // タームのURLと名称を出力
52
-
53
- echo '<p><a href="' . esc_url( $term_link ) . '">' . $term->name;
54
-
55
- echo '</a></p>';
56
-
57
- }
58
56
 
59
57
  ?>
58
+
59
+ ```
60
+
61
+
60
62
 
61
63
 
62
64
 
63
65
  参考にしたのは、
64
66
 
65
- ttp://webcake.no003.info/webdesign/get-terms.html
67
+ [http://webcake.no003.info/webdesign/get-terms.html]
66
68
 
67
69
  のページになります。
68
70
 

1

タイトルが間違っていたので修正しました

2016/06/29 00:57

投稿

tokiodeluxe
tokiodeluxe

スコア18

test CHANGED
@@ -1 +1 @@
1
- 【wordpress】変数宣言、phpファイル間で受け渡しをしたい
1
+ 【wordpress】ターム一覧取得てサムネイル表示させたい
test CHANGED
File without changes