For some reason wordpress don’t honor Template_Hierarchy. The best way to get around this problem is to “force” wordpress to use the custom single.php template that you created. To accomplish that, add the following function underneath your CPT.
/* Information Posts Template selection - a single.php just for our wrestler_profiles */
function pietergoosen_info_template_include( $original_template ) {
if ( isset( $wp->query_vars['wrestler_profiles'] ) && false == $wp->query_vars['wrestler_profiles'] ) {
return get_template_directory() . '/single-wrestler.php';
} else {
return $original_template;
}
}
add_filter( 'template_include', 'pietergoosen_info_template_include' );
Just remember, if you are using your CPT in a child theme or in a plugin, change get_template_directory()
accordingly
Related Posts:
- What is singular.php?
- Associate page w/ specific single post template?
- WordPress giving me the index
- Custom post type single page returns 404 error
- Setting a custom sub-path for blog without using pages?
- Single custom post type page redirecting to 404 page
- 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?
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- Add a Template to a custom post type
- 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
- Dynamic page.php template for custom post types
- How to get a list of term names of the custom post type im currently on in single.php
- is_singular won’t call my functions?
- Pagination on a custom page template
- Multiple templates for custom post type
- posts_nav_link on single post template
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Make custom post type display as a page
- 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
- Archive page for custom post type not working
- Pull in custom content types into page template
- Editable content on a Custom Archive page
- pagination redirecting from page number url before page requested
- Troubles with making a custom template for posts
- How to check the terms in single custom post type template
- How to show the archive / post type description on Single templates
- Posts of custom post type load the page template
- 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 post type not displaying content from single-{custom post type} page
- redirect automatic page that serves custom posttype content
- WordPress showing archive.php instead page
- Setup template_redirect using has_term when NO term assigned
- 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?
- Fields for different parts of a page
- How do you create a custom template to display a category with an image and related posts below?
- How can I set the page template of a new custom post type post?
- single-{post_type}.php not working
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- get comments by current user inside page template
- hide specific div on single.php [closed]
- How do I find a way to create a global single.php for a custom post type?
- Custom page for editing custom post type on frontend based on url
- How to use single.php for creating, reading and editing Custom Posts with ACF
- Can’t access private custom posttype single- or archives-page
- Dynamic assign a custom template to custom post type posts
- How do I display child post types in the parent post type template
- How to add page under a custom post type?
- Custom permalink structure for remote content pages
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Function to allow single post template based on custom taxonomy?
- Display custom post type from template
- How to use pre_get_posts on archive page custom post type
- Give active class to current page on a while loop WP query for custom post types listing
- 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?
- custom post type – project link output via single-portfolio.php
- 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
- Shortcode and get_template_part
- How can I use one instance of page.php to display different custom post types?
- How to make “single post” permalink maintain it’s sub-page structure
- Custom post type option page template
- Custom post Query and WordPress Post Query Clash
- 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
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- Custom post type , page template not grabbing the page template
- Edit single page from plugin
- WordPress custom post type and page
- How to set class to “current-page” on the currently viewed single post within a CPT
- How to display category wise posts on seprarate template
- Pulling in Related Posts based on Post Type array
- 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 to divide posts (custom post type) content on multiple pages?
- how to load custom single.php?
- Conditional Tags If Custom Post Parent & Child?
- How do I paginate a custom post type listing on a custom template page?
- Page template anomaly
- Custom Post Type Template Based on Page Slug?