質問編集履歴
2
カスタムフィールドの登録内容の階層を追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,16 +16,17 @@
|
|
16
16
|
■カスタムフィールドの登録内容
|
17
17
|
カスタムフィールドのフィールドグループ
|
18
18
|
組合(archive-union.php)
|
19
|
-
フィールド名:union_info
|
19
|
+
├フィールド名:union_info
|
20
|
-
フィールドタイプ:Group
|
20
|
+
├フィールドタイプ:Group
|
21
|
+
├サブフィールド
|
21
|
-
|
22
|
+
│ └ 組合名:union_name(テキスト)
|
22
|
-
住所:union_address(テキスト)
|
23
|
+
│ └ 組合住所:union_address(テキスト)
|
23
|
-
TEL:union_tel(テキスト)
|
24
|
+
│ └ 組合TEL:union_tel(テキスト)
|
24
|
-
HP:union_hp(テキスト)
|
25
|
+
│ └ 組合HP:union_hp(テキスト)
|
25
|
-
会員情報:member_info_list(繰り返しフィールド)
|
26
|
+
│ └ 会員情報:member_info_list(繰り返しフィールド)
|
26
|
-
会員名:member_name(テキスト)
|
27
|
+
│ └会員名:member_name(テキスト)
|
27
|
-
住所:member_address(テキスト)
|
28
|
+
│ └会員住所:member_address(テキスト)
|
28
|
-
TEL:member_address(テキスト)
|
29
|
+
│ └会員TEL:member_address(テキスト)
|
29
30
|
|
30
31
|
会員(single-member.php)
|
31
32
|
上記繰り返しフィールドの3件の情報を含む、
|
1
codeを一部修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -188,17 +188,30 @@
|
|
188
188
|
<?php echo $group['union_tel']; ?></p>
|
189
189
|
<p><a href="<?php echo $group['union_hp']; ?>" target="_blank" rel="noopener noreferrer">HP</a></p>
|
190
190
|
</div>
|
191
|
+
<?php
|
192
|
+
$repeater = $group['member_info_list'];
|
193
|
+
|
194
|
+
$r = '0';
|
195
|
+
$r_count = count($repeater);
|
196
|
+
|
197
|
+
while($r_count > $r){
|
198
|
+
|
199
|
+
$repeater_content = $repeater[$r];
|
191
|
-
|
200
|
+
if(get_field('member_info_list')):
|
192
|
-
|
201
|
+
?>
|
193
|
-
|
202
|
+
<dl>
|
194
|
-
|
203
|
+
<dt><a href="<?php echo get_permalink($tax_post->ID); ?>"><?php echo $repeater_content['member_name']; ?></a></dt>
|
195
|
-
|
204
|
+
<dd><?php echo $repeater_content['member_address']; ?></dd>
|
196
|
-
|
205
|
+
<dd><a href="tel:<?php echo $repeater_content['member_tel']; ?>"><?php echo $repeater_content['member_tel']; ?></a></dd>
|
197
|
-
|
206
|
+
</dl>
|
198
|
-
|
207
|
+
<?php else: ?>
|
208
|
+
<p>現在、会員は登録されていません</p>
|
199
|
-
|
209
|
+
<?php endif; ?>
|
210
|
+
|
200
|
-
|
211
|
+
<?php $r++;
|
212
|
+
} ?>
|
201
|
-
|
213
|
+
</div>
|
214
|
+
|
202
215
|
<?php } ?>
|
203
216
|
|
204
217
|
<?php endforeach; wp_reset_postdata(); ?>
|
@@ -222,6 +235,7 @@
|
|
222
235
|
### 試したこと
|
223
236
|
これで会員のカスタム投稿画面にunionという枠が追加されましたが、パーマリンクがunion/member/となるわけでもなく、ページが表示されることもありませんでした。
|
224
237
|
//親子関係
|
238
|
+
```ここに言語を入力
|
225
239
|
add_action('admin_menu', function() {
|
226
240
|
remove_meta_box('pageparentdiv', 'member', 'normal');
|
227
241
|
});
|
@@ -238,6 +252,7 @@
|
|
238
252
|
}
|
239
253
|
}
|
240
254
|
}
|
255
|
+
```
|
241
256
|
|
242
257
|
親子関係を持たせたいのでpage-〇〇.phpでも試してみましたが、タクソノミーを使って親子関係ができるならarchiveとsingleで作成したいです。
|
243
258
|
よろしくお願いいたします。
|