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
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Metabox not show in categories custom post type cmb2
- What is the best practice for displaying my plugin content in themes?
- Categorize custom post type
- How do I display the taxonomy for a custom post type in an array
- Pretty URL for custom search for custom post type
- Custom taxonomy rewrite with query var returns %2F in URL
- WP Rewrite Rule Issue while using Custom post type & taxonomy
- How to list custom taxonomies in the back end
- Several CPT’s with same Taxonomy name but with different Terms for each
- Remove slug in URL custom post type
- Custom Permalinks with CPT and Hierarchical Taxonomies
- How to conditionally redirect to the post from a taxonomy page?
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Sort and filter custom post type posts by custom taxonomy
- How do I display the grand child items of a taxonomy term?
- How to edit this code to get the categories in achieve page?
- Display Child Pages of Custom Post Type Parent Page
- Taxonomies relations
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Versioned Custom Post Type (Not the same as revisions)
- Is it better to use WordPress Custom Post Types or Taxonomies?
- Get general taxonomy name for a Custom Post Type
- Display Custom Taxonomy Alphabetically
- Import data from CSV with custom taxomony empty
- WordPress uses url different from defined in rewrite arg of custom post type
- Custom Post Type Loop with Query Var
- Full Custom Post Type List Organised by two Taxonomies
- Is it possible to use have_posts function to list custom post type posts inside a category?
- WordPress Doesn’t Generate Taxonomy Archive
- Custom post Type, child of a Page?
- Custom Taxonomy isn’t working from frontend post submitting
- URL rewriting for CTP assigned entity
- How to have this permalink structure: post_type/postname/custom_inner_page
- Suggested Post and Taxonomy structure
- How do I require the specification of term in a custom post type and custom taxonomy?
- Custom Post, set object Taxonomy terms in plugin
- Query Custom Post Type Taxonomy term with multiple parameters
- Display post content with respect to its title?
- Hierarchy and access control for Custom Post Types (CPT)
- Auto Complete Search
- Custom Post Type Pagination Paginates Only in URL Structure
- Set post terms for multiple posts
- Load Custom_post_type categories post with ajax
- What code should I use to display children of a custom post?
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Get terms that contain posts that in turn belong to other terms?
- WP-API select custom taxonomy when creating a post
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- First custom field value (out of several) displayed twice after query
- Custom post with more than one custom taxonomy
- How to get custom posts sub category link
- Custom while loop for hierarchical display of a taxonomy
- Removed custom post type slug but not working for child pages
- Terms showing up in object cache on unrelated pages
- Show Custom Post Type meta boxes only on Page Edit
- Lists custom taxonomy terms that has specific custom field value assigned to the term (not post)
- Adding the_content() in custom template email
- Get the taxonomy of a post hierarchically
- 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?
- Adding custom taxonomy in same menu place with two custom post types
- How to make custom taxonomy into drop down select in a custom metabox
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- List Taxonomy Terms based on another Taxonomy
- How to get the intersection of two terms both from different custom taxonomies
- CPT’s with landing page instead of archive – Url Rewrite?
- Template for all categories of a custom post type?
- How to change permalink to include custom post type
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop