I have made the custom post type but its single view is going to index

admin2025-06-05  16

Here's my code:

function create_posttype() {

    register_post_type( 'movies',
        // CPT Options
        array(    'public' => true,

            'labels' => array(
                'name' => __( 'Movies' ),
                'singular_name' => __( 'Movie' )
            ),
            'has_archive' => true,
            'rewrite' => array('slug' => 'movies'),
        )
    );
}

// Hooking up our function to theme setup

add_action( 'init', 'create_posttype' );

I have also created the archive-movies.php and single-movies.php, but when I open the detail page of a post, it's going to index.php and showing the blogs list.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749139047a316691.html

最新回复(0)