我试图只在名为“指令”的子字段中有内容的情况下通过第一个IF语句,这似乎不起作用。如果我删除(&A)&!空(\\u sub\\u字段(\'指令\')
<?php
if( have_rows(\'instructions_group\') && !empty(the_sub_field(\'instruction\')) ):
?>
<div id="instructions-group0" class="instructions-group">
<h2>DIRECTIONS:</h2>
<ol>
<?php
if( have_rows(\'instructions_group\') ):
while ( have_rows(\'instructions_group\') ) : the_row();
$instructionphoto = get_sub_field(\'instruction_photo\');
$instruction = get_sub_field(\'instruction\');
$size = \'recipe-featured\';
$thumb = $instructionphoto[\'sizes\'][ $size ];
$width = $instructionphoto[\'sizes\'][ $size . \'-width\' ];
$height = $instructionphoto[\'sizes\'][ $size . \'-height\' ];
$alt = $instructionphoto[\'alt\'];
if( !empty($instruction) ) : ?>
<li class="instruction">
<div class="instruction-wrap">
<?php if( !empty($instructionphoto) ) : ?>
<img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" />
<?php endif; ?>
<div class="instruction-txt"><?php echo $instruction; ?></div>
</div>
</li>
<?php
endif;
endwhile;
?>
</ol>
</div>
<?php
endif;
endif;
?>