简体   繁体   中英

Why am I getting Unexpected T_STRING with this wordpress function?

I am piecing together a custom post type from the wordpress codex. However, anytime I add more than the first two arguments to the array, I get an error.

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,
        )
    );
}

This is the error:

Parse error: syntax error, unexpected T_STRING in /home/prayerpi/public_html/wp-content/themes/twentyeleven/functions.php on line 611

Line 611 is:

'labels' => array(

Here is the link to the register_post_type codex.

Did you intend to leave the single quote off of this?

register_post_type( 'super_duper,

Probably should be:

register_post_type( 'super_duper',

your missing the ending '

register_post_type( 'super_duper,

change too:

 register_post_type( 'super_duper',

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM