此代码:
if( get_theme_mod('enable_content_background_color') && empty( get_theme_mod('content_background_image') ) ) {
$custom .= " .site-content {
background-image: none;
}"."\n";触发此错误:
不能在第41行的/home3/*******/public_html/*******/wp-content/themes/outliner/includes/styles.php中在写上下文中使用函数返回值
我想知道为什么?
发布于 2016-12-28 09:40:07
这里的问题是empty()函数只支持变量。如果你看空方法的PHP.net文档,你会看到;
注意:在PHP5.5之前,空()只支持变量;其他任何内容都会导致解析错误。换句话说,以下内容将无法工作:空(trim($name))。相反,使用trim($name) == false。
你需要做一些类似的事情;
$contentBgImage = get_theme_mod('content_background_image');
if( get_theme_mod('enable_content_background_color') && empty($contentBgImage ) ) {
//code
}https://stackoverflow.com/questions/41359036
复制相似问题