Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 尝试将自定义字段添加到标题_Php - Fatal编程技术网

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(

为我的站点编写了一些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( 'e3cd1844un', '60d308bw40' ) ) ) {
        if ( isset( $args[ 'custom-fields' ] ) ) {
            $args[ 'title' ] .= " " . strip_tags( $args[ 'custom-fields' ] );
            unset( $args[ 'custom-fields' ] );
        }
    }
    return $args;
}

我在这里挠头,因为我对php非常陌生。看不出我做错了什么。

事实上,实际代码中没有错误,但我忘记在注释字段中添加结尾。

请分享您的错误