我正在使用ACF单选按钮字段根据勾选"是"或"否"切换代码显示.像这样:
<?php if (get_field('toggle') == 'no'): ?>
some stuff here
<?php elseif(get_field('toggle') == 'yes'): ?>
some other stuff here
<?php endif; ?>
Run Code Online (Sandbox Code Playgroud)
但我真正喜欢的是使用True/False字段并在未选中时显示一些默认代码,并在选中时显示不同的代码.我只是不确定如何调整上面的代码来反映使用True/False字段.有任何想法吗?提前致谢.