Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 高级自定义字段复选框显示值_Php_Wordpress_Advanced Custom Fields - Fatal编程技术网

Php 高级自定义字段复选框显示值

Php 高级自定义字段复选框显示值,php,wordpress,advanced-custom-fields,Php,Wordpress,Advanced Custom Fields,我正在努力使用ACF复选框,我正在尝试检查数组以查看是否勾选了“car”: if( in_array( 'car', the_sub_field('tyres_available') ) ) { echo 'some html'; } “汽车”是复选框选项之一。如果勾选了,我想回显一些html。目前,它正在为“轮胎可用”字段中勾选的每个复选框输出整个数组 你知道我哪里做错了吗 谢谢你。它是获取子字段,而不是子字段: <?php $tyreServices = get_sub_fi

我正在努力使用ACF复选框,我正在尝试检查数组以查看是否勾选了“car”:

if( in_array( 'car', the_sub_field('tyres_available') ) )
{
    echo 'some html';
}
“汽车”是复选框选项之一。如果勾选了,我想回显一些html。目前,它正在为“轮胎可用”字段中勾选的每个复选框输出整个数组

你知道我哪里做错了吗


谢谢你。它是
获取子字段
,而不是
子字段

<?php $tyreServices = get_sub_field('tyres_available'); ?>

<?php if(in_array("car", $tyreServices )){ ?>
    Some html
<?php } ?>

一些html