You can filter template_include
and then let WordPress search for a page template in all valid templates like page.php
, index.php
and even files from a parent theme.
add_filter( 'template_include', function( $template ) {
return is_singular( [ 'YOUR_POST_TYPE' ] ) ? get_page_template() : $template;
});
Related Posts:
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Create a custom archive page for a custom post type in a plugin
- Media library – Limit images to custom post type
- How to Add Custom Taxonomy To Woocommerce Plugin
- Development of a WordPress Search Plugin – Best Practices
- Prevent trash/delete action on specific post types
- How to add custom content template part for a custom post type on main query using a plugin
- Rewriting ‘rewrite’ slug for custom post type used by plugin
- echo value from ‘select’ field type into page template using cmb2?
- register_taxonomy with multiple object type and update_count_callback
- How often do you need to register_post_type?
- How to use a dedicated template for the Custom Post Type from a plugin?
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Getting arguments for register_post_type from a plugin generated post type
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Remove POST_TYPE from custom post type permalink
- How to localize value of posts
- How to add post_author column to custom post type
- How to register custom post types in a plugin?
- Display custom taxonomy as dropdown list
- How to append element after thumbnail
- Hide Meta Boxes for Non-Admins
- Issue to get wp_get_attachment_image with cmb2
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Shortcode insertion in tab
- Can’t get order_by meta_value_num to work properly
- Add CPT as subpage under custom page
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- One-to-many post relationships that are displayed by category (using posts-to-posts plugin)
- Custom posts don’t work
- single-{cpt}.php ignored
- Insert and then update post_type by wp_update_post
- Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?
- add category name to permalinks on product page /category-name/product-name
- Action or Filter Hook for a Custom Importer
- How to set a CPT to have a page as a parent, then rewrite urls accordingly?
- Addition of custom option panel crashes Media Library & Admin Area
- Dynamic dropdown select values depending on other custom field value
- Post injections into Site Origins Page builder [closed]
- WordPress randomly shows 404 errors
- Custom Post Type slug same as page name
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- How can you use one database with multisite
- How to add multiple images to a custom post type without plugin [closed]
- How to create multiple editor?
- Custom post type, have only my meta boxes
- New “Custom Types” item in admin menu. Is this a plugin or a new wordpress feature?
- How can I have different content for different countries?
- Pagination hitting 404 page on /page/4
- Can’t delete a custom post in front end with custom role
- Post URL based on Custom Post Types variables
- custom permalink for post only not custom post types
- Add custom field to admin area witthout using a metabox
- Override Plugin Custom Post Type ‘single’ view
- Methods for development wordpress themes [closed]
- Can I assign a theme to a custom post type?
- Custom pages missing on “front page” setting
- Add custom columns in custom post type browse page
- Overriding Plugin Function in Child Theme
- Custom post types, disable fields
- Send post changes to set email addresses (not users or subscribers)
- How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
- Types plugin custom post add_action hooks
- Accessing a protected property of a post
- Multiple archives to display parent and subcategories content
- wordpress post_where set only for my costum post type
- Custom post type 404 error on “default” or “numeric” permalinks
- custom post type single page not found after aotumatic publish By the author’s robot
- Set a template on a custom post in the plugin
- Simple way to hide\show an announcement (just a div) on homepage?
- Custom Post Type works when registered in functions.php but not when registered in plugin
- Restrict Custom Post Type to One Item
- Add input radio menu to post
- CPT UI: Connect a custom post type to a custom post type
- Simple Data picker meta box
- How to check if a new private custom post type is created?
- Looping through image object using ACF and CPT UI [SOLVED]
- Link two different post using there post_id in post meta
- Custom post type that lets users create a set of posts?
- How to create groups like that in buddypress?
- Post that populates itself (almost) automatically using data from imported excel file
- I broke it! Custom post type archive gets redirected to home
- Custom Fields through plugin in a Custom Post Type
- Multiple domains, Single database, 1 Parent/Master with all content, other domains/slaves with filtered content (based on “location” variable)
- How to Create movie schedule by custom post type query
- Remove custom post type generated by a plugin (The Events Calendar) [closed]
- Show custom taxonomy not in submenu
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Loop carousel slider in wordpress
- How to Fix WordPress 500 Internal server error due to custom post type
- Custom Fields as Post Type Options
- get_post_types doesn’t work in plugin
- Customizing a plugin function using a hook
- Configure which plugin custom post types get registered
- Extending a CPT by Created by another plugin
- Display Custom Post Type on Toolset Types Plugin
- How to get ‘Products’ on home page?
- Retrieve a post with its ACF repeater fields in wordpress