Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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为True 1或空条件,则输出_Php_Wordpress_Conditional - Fatal编程技术网

如果PHP为True 1或空条件,则输出

如果PHP为True 1或空条件,则输出,php,wordpress,conditional,Php,Wordpress,Conditional,我使用一个Wordpress自定义字段来显示PHP是否单击了值/TRUE。这很好,但我有大量的自定义帖子,不想手动为每个帖子指定“1”的真实值,这样它就可以工作了。因此,我想要实现的是,如果字段当前为空/空/未输入任何内容,那么也可以回退以输出php。到目前为止,我已经:- <?php $custom_header_visibility = get_field('custom_header_visibility'); if( $custom_header_visibility =='1

我使用一个Wordpress自定义字段来显示PHP是否单击了值/TRUE。这很好,但我有大量的自定义帖子,不想手动为每个帖子指定“1”的真实值,这样它就可以工作了。因此,我想要实现的是,如果字段当前为空/空/未输入任何内容,那么也可以回退以输出php。到目前为止,我已经:-

<?php
 $custom_header_visibility = get_field('custom_header_visibility');
 if( $custom_header_visibility =='1'){ ?>   
 Output here
 <?php }?>
我怎样才能用这种格式来实现呢

谢谢
格伦尼男孩

谢谢大家的意见。如前所述,我意识到我可以反转逻辑,以便在它不等于0 False的情况下响应输出-包括1 True和尚未填充的空字段:-

。。。那么第三行呢

if( $custom_header_visibility !='0'){ ?>    

这取决于get_字段返回的内容…这取决于自定义_标题_可见性字段中存储的内容。现在感觉很傻。我只是设置了条件,使其不是“false”“0”,但仍然对PHP或运算符感兴趣……我很困惑,$custom\u header\u visibility可以有哪些值,您希望实现什么?
if( $custom_header_visibility !='0'){ ?>