I can't figure out why my custom post type page template uses the archive page to display posts. I'm pretty sure I have the right files. These are the important files, regarding this issue, in my root folder:
Root
mytheme
- archive.php
- home.php
- single.php
- team.php
- single-team.php
- archive-team.php
Usage
1. team.php is a custom page template. All team members are shown here.
2. single-team.php displays a single team member.
My Post Type
function create_post_type_team() { register_post_type( 'team',
array(
'labels' => array(
'name' => __( 'Team' ),
'singular_name' => __( 'Team' )
),
'public' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'taxonomies' => array('post_tag')
)
);
}
add_action( 'init', 'create_post_type_team' );
My Problem
When I visit mysite/team (team.php), the page is using archive-team.php to display posts. It should use team.php which is assigned to the page as page template via the admin panel. The weird thing is that when I change the page url from /team to /team2, it does use team.php and not archive-team.php.
Notes
Before this problem occurred, mysite/team/member (single-team.php) was not working. I went to my permalink settings - did nothing - and went back. From this point mysite/team/member worked, but team.php started using archive-team.php. If I set has_arhive => false, it falls back to home.php.
Any help would be much appreciated!