I am following the wp doc for adding a custom post type:
function create_post_type() {
register_post_type( 'startup',
array(
'labels' => array(
'name' => __( 'Startup' ),
'singular_name' => __( 'Startup' )
),
'public' => true,
'has_archive' => false,
)
);
}
add_action( 'init', 'create_post_type' );
I have made single-startup.php in themes root but it doesn't load for any post with that type.
For example if I go to test.com/startup/my-page This will show index.php contents.
I know there are several questions like this, but none of them worked for me. I don't know why.
I have random string in single-startup.php
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod...
When I visit custom post page: 'abc.com/startup/some-startup-page/' I see same content as 'abc.com/' i.e index page.
However when I visit a default type post/page i.e 'abc.com/test-post/' It works perfectly. single-post.php and page.php are loaded correctly.
Its just single-startup.php that is causing problem.