我已经设置了一个名为“asset\\u type”的选择字段,该字段有两个值:“image”和“video”。然后,我有两个依赖于要显示的条件逻辑的字段。如果从选择中选择“image”,则显示“image\\u asset”字段,如果从选择中选择“video”,则显示“video\\u asset”字段。通过阅读文档和其他一些堆栈问题,我认为我的逻辑设置正确,但我一生都无法显示内容。我的代码是这样的:
<?php if(get_sub_field(\'asset_type\') == "image") { ?>
<div><?php the_sub_field(\'image_asset\'); ?></div>
<?php } ?>
<?php if(get_sub_field(\'asset_type\') == "video") { ?>
<div><?php the_sub_field(\'video_asset\'); ?></div>
<?php } ?>
非常感谢您的帮助或建议,谢谢!