I had the same problem. Why WordPress doesn’t automatically use the custom single.php template is above me. That aside, here is the code I’m using to force my CPT to use my custom single.php. Just change the CPT and template name to suite your needs.
<?php
/* Information Posts Template selection - a single.php just for our information posts */
function pietergoosen_info_template_include( $original_template ) {
if ( isset( $wp->query_vars['information'] ) && false == $wp->query_vars['information'] ) {
return get_template_directory() . '/single-information.php';
} else {
return $original_template;
}
}
add_filter( 'template_include', 'pietergoosen_info_template_include' );
?>
Related Posts:
- single-{$post_type}-{slug}.php for custom post types
- Template for specific post of custom post type
- Multiple Single Post templates
- Custom Post Type with Nested Taxonomy and Template Files
- Trying to manage templates on a blog with lots of custom taxonomies
- WordPress Template Hierarchy
- Include custom post type single template, but respect theme override of template if it exists
- WordPress Doesn’t Generate Taxonomy Archive
- Custom Empty Results page for my Custom Post Type
- Templates for hierarchical custom post type
- Custom Post Type homepage template
- Templating advice sub posts of a CTP
- taxonomy – templates are not loading
- Templates for CPT not working
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Single taxonomy for different custom post types
- Custom Homepage As Single Page or Custom Post Type?
- Can I assign a template to a custom post type?
- Get custom post_type’s archive URL
- CPT Template Not Showing – Getting 404
- Custom Post Types 404 Issue
- How to add custom content template part for a custom post type on main query using a plugin
- Loading custom page template via plugin
- Templates for Custom Post Types and Custom Taxonomies
- Using Templates with Custom Post Type UI
- Apply template to custom post type
- Page is defaulting to archive page and not designated template
- How to quickly switch custom post type singular template?
- Using Custom Templates for Custom Post Types for the Genesis Theme Framework?
- Custom templates for posts like for pages: page-{id} vs single-{id}
- Posts in Multiple Columns and Rows with one single loop
- Custom page type – template under page attributes?
- Display different gutenberg template from selected post attributes
- Remove header and footer but KEEP all css and js etc for a custom post template?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Pagination Issue: Custom Post Type In Index
- Create second custom 404 page for selected post type
- is_page_template not working as expected
- Custom post type and taxonomy permalinks – Structure
- Create Template for Custom Post Type same like for Page
- Hook to override title, image and content
- Custom template page with custom archives listing by user
- Template for custom post with custom taxonomy
- Custom taxonomy and custom post type – wrong permalinks and template
- Can I override a CPT template on a per post basis with Gutenberg block editor?
- Content vs Template on custom post
- A case for Hierarchical Custom Posts
- Custom taxonomy returns 404
- Template for all categories of a custom post type?
- Flush Rewrite Rules when new site is created on network
- Archive for a Taxonomy of a Custom Post type
- Custom post type pages return 404 page?
- Template files for Custom Post Type and Taxonomy
- Set templates for custom post types
- Main query not querying any posts in custom taxonomy template
- make permalink go to a custom single.php file
- Creating Sections for Post Types
- Custom post type is using the index.php template
- Get template part with CPT and Custom Taxonomy conditionals
- Template code to split a post and print a custom field?
- Displaying a list of Contacts
- How to create a template to show child terms of a MAIN taxonomy
- How to change single custom post template by custom taxonomy?
- Setting a homepage – doesn’t seem to work
- List of a specific Custom Post Type in Custom Template
- Require custom post type if is_admin() – template doesn’t show up?
- Custom post types templates
- Function to allow single post template based on custom taxonomy?
- Shortcode in pages or tempate files for custom post type
- Custom Post Type, Custom Taxonomy Template: How to get current taxonomy name?
- Add custom template ‘sub-page’ to Custom Post type?
- Load info from customposttype into template page
- Custom post type defaults to index.php for archive page
- How do I force a CPT to select a shared custom template in Post Attributes?
- How to assign post to category
- Question on templates
- Assign for all post of a post type a specific single-post template
- Taxonomy template file not working with a taxonomy that contains a slash
- Custom taxonomy with custom post type template not showing
- How can I load Template file from wordpress plugin
- Include template if a post is a single product
- Loading a template for a URL pattern
- How to decouple custom post types components from template?
- WordPress Custom taxonomy template
- Use one template for different custom post types with the same markup
- Custom page template not being called
- How to display custom post types AND regular posts separately on a shared taxonomy archive?
- Querying multiple taxonomies in URL leads to wrong taxonomy archive
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Custom post type pagination, single page issue
- Multisite – Echo admins profile meta
- CPT Template Not Showing – Getting 404
- Custom template support for custom post type?
- Using custom post types within a section of a template
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Custom Post Type Template Based on Page Slug?
- PHP Button Custom link [closed]
- Choose custom post type template by category
- using a template for more then 1 page
- How can I produce multiple webpages with a different output based on one entry/Page/custom Page?