大家好,我有一个很大的问题,我在wordpress中创建一个网站,但在网站的某些部分显示此错误消息:
警告:第34行的C:\ xampp \ htdocs \ wordpress \ wp-content \ themes \ realty_v1.7 \ realty_v1.7 \ includes \ vc_extend \ row_fix.php中的非法字符串偏移'css'
警告:第39行的C:\ xampp \ htdocs \ wordpress \ wp-content \ themes \ realty_v1.7 \ realty_v1.7 \ includes \ vc_extend \ row_fix.php中的非法字符串偏移'css'
这是.php文件:
<?php
function carell_build_style($bg_image = '', $bg_color = '', $bg_image_repeat = '', $font_color = '', $padding = '', $margin_bottom = ''){
$has_image = false;
$style = '';
if((int)$bg_image > 0 && ($image_url = wp_get_attachment_url( $bg_image, 'large' )) !== false) {
$has_image = true;
$style .= "background-image: url(".$image_url.");";
}
if(!empty($bg_color)) {
$style .= vc_get_css_color('background-color', $bg_color);
}
if(!empty($bg_image_repeat) && $has_image) {
if($bg_image_repeat === 'cover') {
$style .= "background-repeat:no-repeat;background-size: cover;";
} elseif($bg_image_repeat === 'contain') {
$style .= "background-repeat:no-repeat;background-size: contain;";
} elseif($bg_image_repeat === 'no-repeat') {
$style .= 'background-repeat: no-repeat;';
}
}
if( !empty($font_color) ) {
$style .= vc_get_css_color('color', $font_color); // 'color: '.$font_color.';';
}
if( $padding != '' ) {
$style .= 'padding: '.(preg_match('/(px|em|\%|pt|cm)$/', $padding) ? $padding : $padding.'px').';';
}
if( $margin_bottom != '' ) {
$style .= 'margin-bottom: '.(preg_match('/(px|em|\%|pt|cm)$/', $margin_bottom) ? $margin_bottom : $margin_bottom.'px').';';
}
return empty($style) ? $style : ' style="'.$style.'"';
}
function row( $atts, $content ) {
$class = explode( "{", $atts['css'] );
wp_enqueue_style( 'js_composer_front' );
wp_enqueue_script( 'wpb_composer_front_js' );
wp_enqueue_style('js_composer_custom_css');
$style = carell_build_style($bg_image, $bg_color, $bg_image_repeat, $font_color, $padding, $margin_bottom);
return '<style>'.$atts['css'].'</style><section class="'.str_replace( ".", "", $class[0]).'"><div class="container"><div class="row">'.wpb_js_remove_wpautop($content).'</div></div></section>';
}
add_shortcode( 'vc_row', 'row' );
?>
我不知道该怎么办。帮助我!
答案 0 :(得分:0)
请检查功能行(),
function row( $atts, $content )
在此函数中您传递的$ atts可能不是索引为'css'
的数组