I think a hook into template_include
like described here could be a proper way to do this.
Code could be like this:
add_filter('template_include', 'my_plugin_templates');
function my_plugin_templates( $template ) {
$post_types = array('post');
if (is_singular($post_types)) {
$template="path/to/singular/template/in/plugin/folder.php";
}
return $template;
}
Related Posts:
- How to display by default only published posts/pages in the admin area?
- Custom permalink structure only for default posts
- Static posts page with home.php
- Pagination not working on Custom Page Template
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Is there any WordPress alternative to Book module of Drupal?
- Posts vs. Pages
- Can’t get the_content of the parent page from its single post?
- Adding buttons to Add New Post and Add New Page
- Static posts page with home.php
- “about us”, ” contact” sections should be article(post) or page in the simple small Business website?
- Is it possible to customize the post according to post format in single.php?
- disable Tab post on nav-menus page (Admin)
- WordPress Query Posts From Category Post on Static Page
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Organization of time insensitive content
- Can I style single post that are in multiple catergories?
- What would causes search to return incorrect results?
- Changing permalink of WordPress
- Added a ACF field to custom page and want the results to show as a column in admin
- Show post count in custom taxonomy page
- Put page on Archived statut after end of publication date
- post and page and custom post type
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Permalink base only for posts
- Custom Single Post Type not referring to single-post-type.php File
- Add wp-link-pages to post
- Allow users to create their own page/s
- Get current post’s child page?
- Make a custom URL and link to custom Template
- Automatically delete default posts and pages on theme install?
- How to have more post in a page than in your home page
- custom post type single page template not working
- Wrap div-tag around posts in page
- Insert Shortcode exactly at the end of the content
- How to have 2 posting pages on a blog
- Edit Page button is gone
- Single.php – Get Current Parent Category
- How do I do a page break?
- Is there a way to specify an extra class for a post or page with no title?
- Automatically create a new page daily with last three posts
- Using wp_list_pages() after calling query_posts()
- Insert sometext after first h3 in content
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- Display Posts on Custom Page
- How to include my own css in post
- User Selectable Delete of Pages
- Custom post types related to same custom post type?
- How do I insert a post with custom post type and relate it to a custom taxonomy?
- 2 dynamic sidebars registered, not showing up
- Dynamically switch template on click
- Multiple Loops Breaking Pages
- How to get ID of the page included with get_page()?
- Thumbnail Image to go in the post aswell
- Posts vs Pages and categories
- How to dynamically parse and transform post/page content before displaying it?
- Add get_the_tags() to Single Posts section via functions.php
- How to make default “Privacy Policy Page” a normal page?
- Customize rel=canonical tag for single blog post
- a little direction on custom post type
- Proper way of establishing custom landing pages in WordPress
- Multiple comment forms on a single page
- Format latest/newest post differently
- is_page Funtion for Posts ?
- Custom taxonomy archive page problem
- is_page() and is_page_template() not being differentiated
- Tell WP to use a specific template file in posts
- Post type no single page
- Admin – no Featured image choice in create new/page|post
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- How to detect when admin user is on the All Posts page?
- relating business and products with custom taxonomy?
- Best Way to Add UnEditable HTML to Posts
- static landing page leading to author specific pages w/ “live” content
- How safe is it to delete old posts edits to save database space?
- Two Custom Post Types with Identical Articles Competing for the same Slug
- Custom Post Type archive
- WordPress custom post type with folder structure in slug
- Single Post in Tab/Slider
- Using setup_postdata() with multi-dimensional array
- Total number of posts in query (category/tag/author/search results/main page…)
- Is codex right on deleting post?
- Custom Permalink Structure for Pages & Posts
- Getting a “404 Not Found” error when “Preview Changes” is clicked
- Why won’t pagination work?
- Check if a custom post type has already been created
- How to create a “latest news” page showing a list of posts from blog category
- Edit multiple custom post types while saving a new or edited post
- Create a custom posts page
- How do you search for a post or page with a certain url on the WordPress admin panel?
- How to add some html formated text to every new post in WordPress
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- if in category but only with post meta
- How to get different Related Posts
- Intercept page request and add value to it
- How to add convenient buttons for new custom post statuses
- Defined function isn’t showed on page
- WordPress 302 Redirect to Random Product/Post/Page
- How to allow multiple thumbnail upload for Posts?
- add external project to web site wordpress on production