我正在拼写wordpress codex中的自定义帖子类型。但是,无论何时我向数组添加多于前两个参数,我都会收到错误。
add_action( 'init', 'create_my_post_types' );
function create_my_post_types() {
register_post_type( 'super_duper',
array(
'labels' => array(
'name' => __( 'Super Dupers' ),
'singular_name' => __( 'Super Duper' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Super Duper' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit Super Duper' ),
'new_item' => __( 'New Super Duper' ),
'view' => __( 'View Super Duper' ),
'view_item' => __( 'View Super Duper' ),
'search_items' => __( 'Search Super Dupers' ),
'not_found' => __( 'No super dupers found' ),
'not_found_in_trash' => __( 'No super dupers found in Trash' ),
),
'public' => true,
)
);
}
这是错误:
Parse error: syntax error, unexpected T_STRING in /home/prayerpi/public_html/wp-content/themes/twentyeleven/functions.php on line 611
第611行是:
'labels' => array(
以下是register_post_type codex的link。
答案 0 :(得分:1)
您是否打算将单引号保留下来?
register_post_type( 'super_duper,
可能应该是:
register_post_type( 'super_duper',
答案 1 :(得分:0)
你错过了结尾'
register_post_type( 'super_duper,
也改变了:
register_post_type( 'super_duper',