Php 尝试将自定义字段添加到标题
为我的站点编写了一些php代码,将自定义字段添加到标题中,但当我添加它时,会出现语法错误,并破坏了我的站点Php 尝试将自定义字段添加到标题,php,Php,为我的站点编写了一些php代码,将自定义字段添加到标题中,但当我添加它时,会出现语法错误,并破坏了我的站点 add_filter( 'pt_cv_fields_html', 'cvp_theme_other_fields_in_title', 100, 2 ); function cvp_theme_other_fields_in_title( $args, $post ) { global $pt_cv_id; if ( in_array( $pt_cv_id, array(
add_filter( 'pt_cv_fields_html', 'cvp_theme_other_fields_in_title', 100, 2 );
function cvp_theme_other_fields_in_title( $args, $post ) {
global $pt_cv_id;
if ( in_array( $pt_cv_id, array( 'e3cd1844un', '60d308bw40' ) ) ) {
if ( isset( $args[ 'custom-fields' ] ) ) {
$args[ 'title' ] .= " " . strip_tags( $args[ 'custom-fields' ] );
unset( $args[ 'custom-fields' ] );
}
}
return $args;
}
我在这里挠头,因为我对php非常陌生。看不出我做错了什么。事实上,实际代码中没有错误,但我忘记在注释字段中添加结尾。请分享您的错误