If think you were using the wrong filter, please try using ‘single_template’.
I assume you have created a plugin to create your custom post type. In the plugin folder you have a “templates” folder where you put the single page template called “palaver_single.php”.
function palaver_single_mapping($single) {
global $post;
if ( $post->post_type == 'palaver' ) {
if ( file_exists( plugin_dir_path( __FILE__ ) . '/templates/palaver_single.php' ) ) {
return plugin_dir_path( __FILE__ ) . '/templates/palaver_single.php';
}
}
return $single;
}
add_filter( 'single_template', 'palaver_single_mapping' );
So if a single palaver post is viewed, the template file inside the templates folder will be used.
Related Posts:
- What are the differences between custom post type and custom page templates?
- Automatically create child pages when saving a (parent) page
- WP insert post and custom taxonomy
- Ordering Posts List By Taxonomy Terms?
- Custom Post Type Permalink For Parent/Child, 404 Page Not Found Error
- Not Able to Insert Taxonomy Term Using wp_insert_post()
- wp_insert_post custom taxonomy
- Assign category to front end post
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Child page in custom post throws 404 page not found
- WordPress tax_input only if logged in
- Programmatically adding posts
- Multiple portfolios with one custom post type?
- Can I make WordPress use a custom template for a child page
- Custom-Posttype & Custom Taxonomy WP_Query
- How to checked selected category checkbox when my custom post inserted from frontend
- Why cant I add a custom post type to a custom taxonomy?
- Enabling permalinks disables custom page template
- Loop and add Specific Categories and Products Images
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- wp_insert_post deleting previous post custom meta
- WordPress custom post type and page
- Ordering Posts List By Taxonomy Terms?
- Display Custom Taxonomy of custom post type
- install.php Custom Taxonomy Term not being added to custom post
- get tags from custom post type
- Create a shortcode to display custom post types with a specific taxonomy
- List the categories under custom taxonomy
- Custom Post Type and Taxonomy URL rewrite
- 404 on child page when parent page slug is identical to custom post type
- How to replicate some of Drupal Views functionality in WordPress?
- Archive page with multiple taxonomies rewrite
- Show related posts on single page by custom taxonomy on custom post
- Exclude from search all custom posts which are NOT in a taxonomy term
- Sorting for each custom taxonomy
- Dynamic variable for custom taxonomy in loop?
- custom taxonomy – Template not working
- What hook should be used to programmatically create a post only when master post is updated?
- Append taxonomy terms as class names in markup?
- Want to turn WordPress into a paid subscription directory
- Removing Duplicate Custom Taxonomy Terms from within a Dropdown Select?
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Custom post types with custom directories
- Remove custom post type slug not working for child pages
- How to output wordpress custom tags separated by comma?
- Does WordPress limit the length of slug names for Post Meta or Terms?
- Custom Taxonomy Permalinks Redirection
- shortcode to show custom post types by category
- Single Template that can be applied only via URL
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- Custom post type archive page template
- Search Custom Post Type & Taxonomies
- How to hook custom taxonomies to custom post types and make the permalinks work?
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Use Custom Post Type archive page for the taxonomies term archive page
- Is it possible to have dedicated page for parent/child taxonomy?
- Display a grid of taxonomy terms at root taxonomy page
- Nested Custom Post Type or Custom Post Type Parents?
- Display Custom Taxonomy Alphabetically
- posttype/taxonomy/term archive page 404 error
- How to add attributes to taxonomies that may be different from post to post?
- Custom post type, permalinks, taxonomies and blog posts
- Taxonomy in URL
- Display related custom taxonomy posts in sidebar
- Different slug taxonomy for two different CPT
- Why does my taxonomy have a category style div id?
- Query not work for current taxonomy
- Hide custom post type from search based on custom taxonomy
- Custom Post type date archive for custom taxonomy
- Replicating category/location page heirarchy
- WordPress custom permalink and archive link for custom post type
- Copy/Move selected taxonomy terms to another taxonomy for posts
- Non-permalink custom taxonomy not found
- Looking up custom taxonomy IDs by name
- Correct way of adding taxonomy to a custom post type
- Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?
- Change dynamically the dropdown list value
- Remove custom taxonamy slug with pagination
- How to associate custom taxonomy terms with custom post type?
- Taxonomies are not showing in the category dropdown
- get_the_terms child terms for current post/custom post only
- Custom Taxonomy – fields
- CPT Loop, include taxonomies and disclude others?
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Custom taxonomy- only output relevant terms
- Post types showing tables…Can I do that?
- Dropdown switching subcategories portfolio
- Is it possible to add and display custom post types to an array?
- How to solve performance issue caused by custom post type overview with 20k+ custom taxonomy terms
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- Prevent repetitive terms in get_the_term_list
- Displaying posts exclusively in their category (not parent)
- Show taxonomies from specific CPT
- Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
- Category / Custom Post Type permalink issue
- After wp_insert_post() custom post type does not show in the admin
- the_post_navigation in single page with multiple taxonomies
- Url rewrite with custom post type and taxonomy
- display related posts based on the PAGE TITLE
- Custom Sort Order for Custom Post Type Taxonomy