It sounds like you are talking about this page display template:
page-{slug}.php
– If the page slug isrecent-news
, WordPress will look
to usepage-recent-news.php
And you want single-{cpt-slug}-{slug}.php
.
If so, I believe you can approximate that page template handling with the following:
function cpt_slug_template_wpse_117630($template) {
global $post;
$templ = locate_template('single-'.$post->post_type.'-'.$post->post_name.'.php');
if (
'book' == $post->post_type
&& 'poem' == $post->post_name
&& !empty($templ)) {
$template = get_stylesheet_directory().'/single-'.$post->post_type.'-'.$post->post_name.'.php';
}
return $template;
}
add_filter('single_template','cpt_slug_template_wpse_117630');
Related Posts:
- Setting a custom sub-path for blog without using pages?
- Add Content to Page without shortcodes
- Loading custom page template via plugin
- How to quickly switch custom post type singular template?
- Create second custom 404 page for selected post type
- is_page_template not working as expected
- Help with CPT template pagination
- Filter widget outputs
- Custom post type pages return 404 page?
- How to get the current category with custom posts
- Custom permalink structure for remote content pages
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- A certain theme is forcing it’s singular post layout
- Question on templates
- Custom post type option page template
- How can I load Template file from wordpress plugin
- How can I find out what template is my custom post type using?
- Loading a template for a URL pattern
- Custom Homepage As Single Page or Custom Post Type?
- Using custom post types within a section of a template
- Custom Post Type Template Based on Page Slug?
- using a template for more then 1 page
- display different template based on post type
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- How to set a fall back template for a custom post type in a plugin?
- Post formats “audio” and “video” only showing in index.php
- Creating a Custom Post Type for Inserting Preset Content into Post & Pages?
- How to list/show all custom post types regardless of category?
- 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
- How to query custom posts using a dynamic category
- Dynamic page.php template for custom post types
- Custom Post Type with Nested Taxonomy and Template Files
- Pagination on a custom page template
- Create Pages from Database
- Custom post type loops with different page templates
- Multiple templates for custom post type
- Include different loop templates in search query
- How to make an archive page displaying posts in a date range
- Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page
- Child page in custom post throws 404 page not found
- CPT: archive-cpt.php VS custom page template
- Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template
- Custom Blog Post Listing in Genesis Sample Child Theme
- Multiple templates for a custom post type
- Editable content on a Custom Archive page
- Troubles with making a custom template for posts
- Custom Page that comes with preloaded content for the user
- redirect automatic page that serves custom posttype content
- Show Custom Post Type meta boxes only on Page Edit
- Creating a Page Template to display all items from a Custom Post Type
- Why does my content disapear when I make a page to match an archive name?
- Adding Page Templates to post but it ignored it
- Fields for different parts of a page
- WordPress custom taxonomy template not working
- How to specify a template for a path like http://example.com/something?
- How can I set the page template of a new custom post type post?
- WordPress 3.9 not using custom template
- How to Create Template File for Parent Page of Custom Post Type
- Custom post_type search pages
- how to remove pages loading with the archive templates
- Custom Empty Results page for my Custom Post Type
- WordPress Picks Up Wrong Template for Custom Post Type Archive Page
- Associate page w/ specific single post template?
- Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times
- get comments by current user inside page template
- Custom post types with categories in template
- Custom page for editing custom post type on frontend based on url
- assign different templates to custom post type with homepage loop
- Custom post type draft use wrong template
- How can I add in post’s the text “No content”
- Calling a div and content in php?
- Tag template not returning posts [closed]
- Specifying a template for custom post type pages
- Display custom post type from template
- Custom post type set default template using block editor
- How to use pre_get_posts on archive page custom post type
- How to change Elementor Template for Single Page Post on Load
- Post template not applying on theme (potentially rendering as Page template)
- How do I find out which (page) template file my custom child post is looking for?
- Custom Post Taxonomy Template Not Loading Properly
- How can I use one instance of page.php to display different custom post types?
- Templating advice sub posts of a CTP
- Custom post Query and WordPress Post Query Clash
- How to display a custom post as a page (but unedited)?
- How to override post-new.php with custom template
- Search custom post type result in same template page
- Custom post type , page template not grabbing the page template
- Can I organise my custom post types by page?
- I want to create an archive and single page for a custom taxonomy for a custom post type
- custom post type plugin – single template
- custom post type archive slug vs. custom page template
- How to create a custom template for this custom post type?
- How to divide posts (custom post type) content on multiple pages?
- Storing postID in session variable to query database when visitor on custom template page
- Page template anomaly
- How to make a template for a specific post of a custom post type?
- WP_Query is getting the post but the_post() not rendering any Post
- display related posts based on the PAGE TITLE