0
ACF Pro를 사용하고 있으며 팀 구성원이라는 사용자 정의 게시 유형이 있습니다. 하위 필드 "member_name"이있는 team_information이라는 repeater 필드가 있습니다. 멤버 이름의 모든 값을 드롭 다운 목록에 표시하려면 어떻게합니까? 지금은 그냥 기본값을 표시합니다. 어떤 도움을 주시면 감사하겠습니다. 코드ACF 하위 필드 값을 드롭 다운 목록으로 표시
<select>
<option value="name" selected><b>Select a Team Member</b></option>
<?php
// check if the repeater field has rows of data
if(have_rows('team_information')):
// loop through the rows of data
while (have_rows('team_information')) : the_row();
?>
<option><?php echo get_sub_field('member_name'); ?></option>
<?php
endwhile;
endif;
?>
</select>
당신이 여기보다 코드를 고수하고자하는 경우 아래
가<?php
// check if the repeater field has rows of data
if(have_rows('team_information')):
// loop through the rows of data
while (have_rows('team_information')) : the_row();
$teamMember= get_sub_field('member_name');
endwhile;
endif;
?>
<select>
<option value="name" selected><b>Select a Team Member</b></option>
<?php foreach($teamMember as $team) :?>
<option><?php echo $team; ?></option>
</select>
드롭 다운에 첫 번째 것을 확인하겠습니다. –
여러 가지 방법이 있습니다
–두 옵션 모두 드롭 다운 목록에 하나의 아티스트 이름을 표시하고 있지 않습니다. –