高级自定义字段:如果复选框设置为true,请取消选择其他所有为true的复选框

时间:2020-06-01 06:42:14

标签: conditional-statements advanced-custom-fields

我有具有高级自定义字段的自定义帖子类型,并且其中一个字段为true / false复选框。现在可以将所有帖子都设置为true,但是我只需要一个即可-如果在任何帖子中某处设置为true时已经选中一个,则应该设置为true自动为假。有人可以帮助实现这一结果吗?

我当前的代码如下:

<?php
    $markAsBest = get_post_meta( get_the_ID(), 'set_best', true );
if ( $markAsBest == 1 )

{ ?>
    <?php get_template_part( 'template-parts/content-video' ); ?>
<?php } ?>

0 个答案:

没有答案