开发者

Wordpress - Weird post template issue

开发者 https://www.devze.com 2023-03-30 04:06 出处:网络
Im using the example from the wordpress site to add new post type, im using wp3.2.1, which is as below

Im using the example from the wordpress site to add new post type, im using wp3.2.1, which is as below

// Add custom post type for the case studies
add_action( 'init', 'create_casestudy_post_type' );
function create_casestudy_post_type() {
    register_post_type( 'case_study',
        array(
            'labels开发者_JAVA技巧' => array(
                'name' => __( 'Case Studies' ),
                'singular_name' => __( 'Case Studies' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'case-studies')
        )
    );
}

This code i have put in the functions.php file in my themes directory.

The problem is when i try and view the URL, it returns a 404 page not found ... im using single-case_study.php for the page template, but it just 404's all the time.

My permalinks are set to /%category%/%postname%/ in the custom structure.

Any help? .. this is really bugging me out

Cheers


You can use Custom Post Type UI plugin to create a custom post type.

0

精彩评论

暂无评论...
验证码 换一张
取 消