我具有这样的功能:
function abc(){
if ( of_get_option('pattern_option') != '' ) {
$pattern = of_get_option('pattern_option');
$custom_pattern = '
html{
background: url('.echo $pattern .') repeat !important;
}
.page_site{
background: url($pattern) repeat !important;
}
';
};
};
我如何回荡背景URL,我尝试以多种方式尝试,没有任何帮助,总是会出现解析错误。
感谢您的时间
使用.
操作员,您需要将$pattern
变量加入字符串。
换句话说,
$custom_pattern = '
html{
background: url('.$pattern.') repeat !important;
}
.page_site{
background: url('.$pattern.') repeat !important;
}
';
if ( of_get_option('pattern_option') != '' ) {
$pattern = of_get_option('pattern_option');
$custom_pattern = '
html{
background: url('. $pattern .') repeat !important;
}
.page_site{
background: url(' . $pattern . ') repeat !important;
}';
}
尝试这样。
function abc() {
if (of_get_option('pattern_option') != '') {
$pattern = of_get_option('pattern_option');
$custom_pattern = 'html {';
$custom_pattern .= ' background: url(' . $pattern . ') repeat !important;';
$custom_pattern .= '}';
$custom_pattern .= '.page_site {';
$custom_pattern .= ' background: url('. $pattern . ') repeat !important;';
$custom_pattern .= '}';
}
}