WordPress Adding a template via a plugin

I'm writing a plugin for a website, and one of the pages on the websites requires a custom template. How can I add a template via the plugin, without having to go into the theme's folder and adding it manually?

Any help would be appreciated.


if you don't want to change the existing theme you can always create a child theme: Wordpress Codex: Child Themes

Similar questions

Add custom post type template via plugin
I'm creating a plugin for a custom post type. I want to add a custom template for it. But I'm not sure how to add it via the plugin. How can I add a custom post type template via the plugin? Please help!
Wordpress custom sub template, Template within template
I have a custom post type defined in Wordpress. Please look at the following image(not my work just used for reference): For each of the posts within the custom post type I would like to define 3 sub templates that can be chosen from within the WP admin:- Content left, Content centre, Content right. When they are rendered out within the loop (not s...
Moving Wordpress installation via SSH breaks, via FTP works like a charm
I am trying to move a Wordpress installation through svn but I am having problems. Moving through FTP (Filezilla, copy to desktop then copy to new location on server) works perfectly. Moving it using cp and mv in SSH works perfectly too. Doing svn co <url> to checkout a copy of the repository results in 500 Internal Server Error and I can't f...
Use latest Boostrap deliverd via MAXCDN via Wordpress
I am creating my first wordpress theme from a static site I have built which runs on Boostrap delivered by CDN. Please no suggestions to download boostrap for this project it needs to be delivered via the CDN. I would like to load boostrap via the CDN using my functions.php file but instead of loading it just displays the text at the top of the loa...
Which is faster: loading images via repo, or loading via ACF/Media Library in WordPress?
I have two methods of loading images in my mind right now during WP Theme Development: 1 - I store an image in a folder within my repo, and load it as a background image, defining it statically in CSS/Inline CSS. 2 - I store an image in the WordPress Media Library, upload it to an Image Content field within Advanced Custom Fields, and then load the...
How to get page template name? e.g. Template Name: template name
Is there any way to get the name of the page template? I mean in a page template, at the beginning we write Template Name: template name I want "template name" by page-id I've tried get_post_meta(get_the_ID(), '_wp_page_template', true) and get_page_template_slug($post_id) but none of the function helped

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.