title: how to attach a page to a custom post type
body: <p>This has worked for me in the past, so I am unsure why it is not working now. </p>
  
  <p>I have created a custom post type:</p>
  
  <pre><code>add_action('init', 'register_team');   
  function register_team(){
          $args = array(
              'label' =&gt; __('Design Team'),
              'singular_label' =&gt; __('Design Team'),
              'public' =&gt; true,
              'show_ui' =&gt; true,
              'capability_type' =&gt; 'post',
              'hierarchical' =&gt; true,
              'rewrite' =&gt; array("slug" =&gt; "design-team",'with_front' =&gt; true), // Permalinks format
              'supports' =&gt; array( 'title', 'editor', 'thumbnail' ),
              'add_new' =&gt; __( 'Add New Member' ),
              'add_new_item' =&gt; __( 'Add New Member' ),
              'edit' =&gt; __( 'Edit Member' ),
              'edit_item' =&gt; __( 'Edit Member' ),
              'new_item' =&gt; __( 'New Member' ),
              'view' =&gt; __( 'View Member' ),
              'view_item' =&gt; __( 'View Member' ),
              'search_items' =&gt; __( 'Search Design Team' ),
              'not_found' =&gt; __( 'No info found' ),
              'not_found_in_trash' =&gt; __( 'No info found in Trash' ),
              'parent' =&gt; __( 'Parent Info' ),
              'menu_position' =&gt;__( 7 ),
             );
  
          register_post_type( 'team' , $args );
      }
  </code></pre>
  
  <p>and called the function which I can see in the CMS, add new entries, etc. I need to attach a page template to this custom post type. On the same site, I have created a custom post type named showroom, and attached the custom post type to a page by creating a file called page-showroom.php. However, when I create a file called page-team.php, it will not associate to this page. Is this a syntax issue?</p>
  
  <p><strong>UPDATE</strong>
  I got around this by creating a page in the CMS, and adding the template using the Page Attributes. The reason I do not particularly like this solution is due to the possibility a user could change the template of the page, causing it to no longer work.</p>
  
  <p>I just feel like I am missing something relative to how the WP Core defines page-?? variable template names or it is a typo, stupid mistake, etc...</p>
  
  <p><strong>UPDATE</strong>
  As requested, here is the code from functions.php which loads all of my CPT's</p>
  
  <pre><code>// CUSTOM POST TYPES
  add_action('init', 'register_showroom');
  add_action('init', 'register_project_gallery');
  add_action('init', 'register_slideshow');
  add_action('init', 'register_team');
  
  
  // ADD Showroom
  function register_showroom(){
      $args = array(
          'label' =&gt; __('Showroom'),
          'singular_label' =&gt; __('Showroom'),
          'public' =&gt; true,
          'show_ui' =&gt; true,
          'capability_type' =&gt; 'post',
          'hierarchical' =&gt; true,
          'rewrite' =&gt; array("slug" =&gt; "showroom",'with_front' =&gt; true), // Permalinks format
          'supports' =&gt; array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'page-attributes' ),
          'add_new' =&gt; __( 'Add New' ),
          'add_new_item' =&gt; __( 'Add New' ),
          'edit' =&gt; __( 'Edit' ),
          'edit_item' =&gt; __( 'Edit' ),
          'new_item' =&gt; __( 'New' ),
          'view' =&gt; __( 'View' ),
          'view_item' =&gt; __( 'View' ),
          'search_items' =&gt; __( 'Search Showroom' ),
          'not_found' =&gt; __( 'No info found' ),
          'not_found_in_trash' =&gt; __( 'No info found in Trash' ),
          'parent' =&gt; __( 'Parent Info' ),
          'menu_position' =&gt;__( 4 ),
         );
  
      register_post_type( 'showroom' , $args );
  }
  
  
  // ADD Project Gallery
  function register_project_gallery(){
      $args = array(
          'label' =&gt; __('Project Gallery'),
          'singular_label' =&gt; __('Project Gallery'),
          'public' =&gt; true,
          'show_ui' =&gt; true,
          'capability_type' =&gt; 'post',
          'hierarchical' =&gt; true,
          'rewrite' =&gt; array("slug" =&gt; "project-gallery",'with_front' =&gt; true), // Permalinks format
          'supports' =&gt; array( 'title', 'editor', 'thumbnail' ),
          'add_new' =&gt; __( 'Add New' ),
          'add_new_item' =&gt; __( 'Add New' ),
          'edit' =&gt; __( 'Edit' ),
          'edit_item' =&gt; __( 'Edit' ),
          'new_item' =&gt; __( 'New' ),
          'view' =&gt; __( 'View' ),
          'view_item' =&gt; __( 'View' ),
          'search_items' =&gt; __( 'Search Project Gallery' ),
          'not_found' =&gt; __( 'No info found' ),
          'not_found_in_trash' =&gt; __( 'No info found in Trash' ),
          'parent' =&gt; __( 'Parent Info' ),
          'menu_position' =&gt;__( 5 ),
         );
  
      register_post_type( 'project_gallery' , $args );
  }
  
  // ADD Slideshow
  function register_slideshow(){
      $args = array(
          'label' =&gt; __('Homepage Slideshow'),
          'singular_label' =&gt; __('Homepage Slideshow'),
          'public' =&gt; true,
          'show_ui' =&gt; true,
          'capability_type' =&gt; 'post',
          'hierarchical' =&gt; true,
          'rewrite' =&gt; array("slug" =&gt; "project-gallery",'with_front' =&gt; true), // Permalinks format
          'supports' =&gt; array( 'title', 'excerpt', 'thumbnail' ),
          'add_new' =&gt; __( 'Add New Slide' ),
          'add_new_item' =&gt; __( 'Add New Slide' ),
          'edit' =&gt; __( 'Edit' ),
          'edit_item' =&gt; __( 'Edit' ),
          'new_item' =&gt; __( 'New' ),
          'view' =&gt; __( 'View' ),
          'view_item' =&gt; __( 'View' ),
          'search_items' =&gt; __( 'Search Homepage Slideshow' ),
          'not_found' =&gt; __( 'No info found' ),
          'not_found_in_trash' =&gt; __( 'No info found in Trash' ),
          'parent' =&gt; __( 'Parent Info' ),
          'menu_position' =&gt;__( 6 ),
         );
  
      register_post_type( 'slideshow' , $args );
  }
  
  // ADD Design Team
  function register_team(){
      $args = array(
          'label' =&gt; __('Design Team'),
          'singular_label' =&gt; __('Design Team'),
          'public' =&gt; true,
          'show_ui' =&gt; true,
          'capability_type' =&gt; 'post',
          'hierarchical' =&gt; true,
          'rewrite' =&gt; array("slug" =&gt; "design-team",'with_front' =&gt; true), // Permalinks format
          'supports' =&gt; array( 'title', 'editor', 'thumbnail' ),
          'add_new' =&gt; __( 'Add New Member' ),
          'add_new_item' =&gt; __( 'Add New Member' ),
          'edit' =&gt; __( 'Edit Member' ),
          'edit_item' =&gt; __( 'Edit Member' ),
          'new_item' =&gt; __( 'New Member' ),
          'view' =&gt; __( 'View Member' ),
          'view_item' =&gt; __( 'View Member' ),
          'search_items' =&gt; __( 'Search Design Team' ),
          'not_found' =&gt; __( 'No info found' ),
          'not_found_in_trash' =&gt; __( 'No info found in Trash' ),
          'parent' =&gt; __( 'Parent Info' ),
          'menu_position' =&gt;__( 7 ),
         );
  
      register_post_type( 'team' , $args );
  } 
  </code></pre>
  
  <p>So I can successfully create a page-showroom.php, page-project_gallery.php, single-project_gallery.php, single-showroom.php which automatically attach themselves to the correct CPT but if I create page-team.php, it just loads the page.php.</p>
  
  <p>Here is a sample of page-showroom.php, which works:</p>
  
  <pre><code>&lt;?php /*  Template Name: Showroom   */ ?&gt;
  
  &lt;?php get_header(); ?&gt;
  
      &lt;div id="primary" class="site-content showroom"&gt;
          &lt;div id="content" role="main"&gt;
  
              &lt;?php while ( have_posts() ) : the_post(); ?&gt;
                  &lt;?php get_template_part( 'content', 'showroom' ); ?&gt;
              &lt;?php endwhile; // end of the loop. ?&gt;
  
          &lt;/div&gt;&lt;!-- #content --&gt;
      &lt;/div&gt;&lt;!-- #primary --&gt;
  
  &lt;/div&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>
  
  <p>and page-team.php, which does not work</p>
  
  <pre><code>&lt;?php /*  Template Name: Team   */ ?&gt;
  
  &lt;?php get_header(); ?&gt;
  
      &lt;div id="primary" class="site-content team"&gt;
          &lt;div id="content" role="main"&gt;
  
              &lt;?php while ( have_posts() ) : the_post(); ?&gt;
                  &lt;?php get_template_part( 'content', 'team' ); ?&gt;
                  &lt;?php //comments_template( '', true ); ?&gt;
              &lt;?php endwhile; // end of the loop. ?&gt;
  
  
  
          &lt;/div&gt;&lt;!-- #content --&gt;
      &lt;/div&gt;&lt;!-- #primary --&gt;
  
  &lt;/div&gt;
  &lt;?php get_footer(); ?&gt;
  </code></pre>