如何在reduxframework中不显示空字段值

时间:2018-09-22 16:02:18

标签: wordpress redux-framework

我在我的wordpress主题管理面板中使用redux框架。 我使用此代码显示图片标题背景:

<?php
global $redux_demo;
echo '<style type="text/css">';
if(!empty($redux_demo['header-bg-image'])) {
echo '.mheader {background: url('.$redux_demo['header-bg-image']['url'].')}';
}   
echo '</style>';
?>

但是当header-bg-image字段为空时,我的代码输出是:

.mheader {
    background: url();
}

当header-bg-image为空时,我什么也不显示。 请帮我。 原谅我语法不好。

0 个答案:

没有答案
相关问题