我已经为$old_pdf1
添加了一个值,var将其转储以进行测试,然后就可以了。所以我然后添加了elseif语句,但现在它将不再显示。
如果我在elseif语句之前的var_dump它显示了我想要的URL,如果我把它放在最后它不会返回任何内容。
<?php
$old_pdf1 = get_field('old_pdf_file_1');
if( have_rows('pdf_files') ): ?>
<ul>
<?php while( have_rows('pdf_files') ): the_row(); ?>
<li><?php the_sub_field('case_study_pdf'); ?></li>
<?php endwhile; ?>
</ul>
<?php
elseif( !empty($old_pdf1) ):
the_field('old_pdf_file_1');
?>
<?php endif; ?>