You should NOT use flush_rewrite_rules when you register your custom post type.
Doing so means you will flush permalinks on every page load.
Instead you should use the register_activation_hook.
Re the template issue: Try renaming the template to single-dossier.php
And try changing your register_post_type array to this:
register_post_type( 'dossier' , array(
'label' => __('Dossiers'),
'singular_label' => __('Dossier'),
'public' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'dossier' ),
'capability_type' => array('dossier', 'dossiers'),
'hierarchical' => true,
'has_archive' => false,
'menu_position' => 3,
'supports' => array('title', 'editor', 'thumbnail', 'page-attributes')
));
Related Posts:
- What are the differences between custom post type and custom page templates?
- Setting a custom sub-path for blog without using pages?
- Loading custom page template via plugin
- Post formats “audio” and “video” only showing in index.php
- Ordering Posts List By Taxonomy Terms?
- Creating a Custom Post Type for Inserting Preset Content into Post & Pages?
- WordPress keeps fetching the archive page instead of the template page
- How to add custom template in plugin?
- How to quickly switch custom post type singular template?
- Add a Template to a custom post type
- How to use a dedicated template for the Custom Post Type from a plugin?
- WordPress calls archive page instead of Custom Page Template
- How do I Make a custom post type get a custom post template in a plugin
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Dynamic page.php template for custom post types
- Pagination on a custom page template
- Multiple templates for custom post type
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- is_page_template not working as expected
- Child page in custom post throws 404 page not found
- CPT: archive-cpt.php VS custom page template
- Multiple portfolios with one custom post type?
- Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template
- Including Custom Post Type posts in a page template contextually (or should I widget?)
- Custom Blog Post Listing in Genesis Sample Child Theme
- Pull in custom content types into page template
- Editable content on a Custom Archive page
- Troubles with making a custom template for posts
- Creating a Page to View the List of Posts for a Custom Post Type?
- Change archive page template using pre_get_post
- Custom Page that comes with preloaded content for the user
- Custom-Posttype & Custom Taxonomy WP_Query
- Page template with different page and post content
- redirect automatic page that serves custom posttype content
- Adding sidebar to template creates horizontal gap the size of the side bar
- WordPress showing archive.php instead page
- Show Custom Post Type meta boxes only on Page Edit
- Creating a Page Template to display all items from a Custom Post Type
- Filter widget outputs
- Why does my content disapear when I make a page to match an archive name?
- Custom Post Type Template Alternative
- General advice on addressing content-centric pages
- Fields for different parts of a page
- Multiple templates for single custom post type
- How do you create a custom template to display a category with an image and related posts below?
- WordPress Custom Search by post_type
- Pages Become “Archive” Instead of Using Page Template
- How can I set the page template of a new custom post type post?
- Custom post type pages return 404 page?
- Multiple single templates?
- Custom URL redirect in WP
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- Associate page w/ specific single post template?
- get comments by current user inside page template
- page template for custom post type
- How to integrate single and archive templates for custom post type in any WordPress theme
- wp_get_canonical_url showing first url of the post for custom page
- Custom page for editing custom post type on frontend based on url
- How do I display child post types in the parent post type template
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- Custom permalink structure for remote content pages
- Mixing Custom Post Types and Page Templates in WordPress 3.7.1
- Display custom post type from template
- Problem with custom loop navigation inside the blog page
- WordPress giving me the index
- How to use pre_get_posts on archive page custom post type
- Can I automatically assign a page template to a custom post type (i.e page-slug.php file)
- Virtual page and loading template
- Custom Post type dont use custom page template (slug is not right)
- How to change Elementor Template for Single Page Post on Load
- A certain theme is forcing it’s singular post layout
- How to create additional rendering for custom post types?
- How do I find out which (page) template file my custom child post is looking for?
- Set a template on a custom post in the plugin
- How can I use a custom template to load custom post type posts based on a post_meta value
- How can I use one instance of page.php to display different custom post types?
- Question on templates
- Custom post type option page template
- Custom post Query and WordPress Post Query Clash
- How can I load Template file from wordpress plugin
- How to display a custom post as a page (but unedited)?
- How can I find out what template is my custom post type using?
- Search custom post type result in same template page
- Custom post type , page template not grabbing the page template
- WordPress custom post type and page
- Ordering Posts List By Taxonomy Terms?
- Custom Homepage As Single Page or Custom Post Type?
- custom post type archive slug vs. custom page template
- How to create a custom template for this custom post type?
- Nested custom post types templating
- How do I paginate a custom post type listing on a custom template page?
- Custom Post Type order Title ASC
- get tags from custom post type
- Custom Post Type Template Based on Page Slug?
- using a template for more then 1 page
- display related posts based on the PAGE TITLE
- I want to show a list of posts under specified categories
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs