You can use the “page_template” filter to load a custom template for a given page. It will replace the template used whenever the “page” template is called.
Remember to add the template file somewhere on your plugin folder.
add_filter( 'page_template', 'custom_template_function' );
function custom_template_function( $page_template )
{
if ( is_page( 'my-custom-page-slug' ) ) {
$page_template = dirname( __FILE__ ) . '/custom-template.php';
}
return $page_template;
}
Related Posts:
- Content generator for development site [closed]
- Some way to Flush or Overwrite all Imported Content in a Site for a Fresh Import – How?
- Is there a way to share content amongst wordpress sites
- Capitalize All Titles and Headlines in Chicago Style
- plugings request url is the old url
- Next and/or previous post content
- Can we use a webservice with WordPress?
- Collapse content [closed]
- Can I use a plugin for a singular page on my website?
- Front end inline editing?
- Insert Message before content of after title
- Add Content to Content()
- Timed content and flagging content as viewed by user?
- Why are my WordPress store items showing up in duplicates?
- plugin wraps the entire content
- Get post content from outside the loop with plugin shortcode usability
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Filtered content appears in the excerpt
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- Plugin for visitors to edit content without logging in? [closed]
- Restrict posts to customers with complete WooCommerce orders only
- Multisite – Cloning CPT pages + content (including ACF Flexible Content) from site to site
- Displaying different content depending on variable
- How can I add a custom Javascript snippet to display my feedback in footer?
- Tool to highlight text in WordPress page and provide additional text on hover
- How can I change page content for good once a button is pressed?
- Content disappears when searching with Search & Filter plugin
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- Copying content from my other websites
- Building a Article Library within WP?
- custom template only for content
- How to hook into search results template or query?
- How to create custom content on custom page from plugin?
- Carrying information from button click into form [closed]
- Contents are missing but shown when switching to another theme in wordpress
- Get content or excerpt of top rated votes @GD-Star Rating? [closed]
- is ther a plugin that will hide/show content for a scheduled period of time? [closed]
- Add a filter to a different custom plugin
- What is the correct method for updating post content from a plugin?
- Single dash converted to double dash
- My page content doesn’t show up
- Distribute post content through several divs [closed]
- Shortcode returning specific content of a post
- Change page content based on dropdown selection
- Auto-scroll to beginning of accordion item
- WordPress sharding: which multi-DB plugin to use?
- wp_enqueue_scripts not working in custom theme
- Is there a plugin to show the code tag button on the visual editor?
- OEmbed from Pinterest
- Posts wont expire
- Add Top-Level Menu that opens URL
- Override Theme CSS with CSS from a plugin
- How to limit 1 image per post on homepage only?
- Something is generating spam pages on my site
- Gutenberg List Extension Block
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Regenerate images with automatic ALT and TITLE attributes
- Single Must Use Plugins Directory for local development
- Confused about shortcode and settings values
- Running jquery script after shortcode [closed]
- Advice for a voting / multiple rating plugin for post types other than GD Star Rating [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Force Plugin Updates: “Update Failed: Plugin update failed.” after update one plugin
- Create mobile navigation header with settings integration
- Access WordPress data from external PHP application.
- Can you use another Profile Builder shortcodes through advanced custom fields
- Comment section not showing correctly
- WP Plugins – Use includes to display page content
- Recent posts per category loop?
- WordPress as a data-store?
- How do I use add_action on custom widget?
- Keeping and updating ACF and ACF Pro at the same time
- How to deal with Slow HTTP POST (slowloris) vulnerability
- What is the purpose of WP_CONTENT_URL?
- Control page content visibility based on URL parameter
- WooCommerce Shopping Cart Not Initially Showing Products [closed]
- download button for audio file in post [closed]
- Print posts category or tag as a formatted journal
- Creating a search form and displaying results
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- problem with register_activation_hook in plugin
- should i use GLOB_ONLYDIR to hook add-ons for wordpress plugin
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Allow webp use on website but disallow webp as featured image during post creation
- Using sessions or an alternative in a plugin
- Can I create a separate admin section for my plugin?
- How to remove default action from a plugin?
- WordPress Contact 7 Form – Remove WordPress from the From Sections
- EventON – Dequeue Styles
- Pagination not working with pagenavi
- Building a dynamic web app for questionnaire
- Using WordPress to create a simple web app (SaaS) [closed]
- wp_signon returns user, in popup window, but the user is not logged in
- Searched & tried a lot: Is it Possible to Eliminate Render Blocking Manually
- WordPress plugin – multiple php files
- Upacking the package… stalls, but installs plugin
- How to add a plugin in WordPress theme directory?
- wp insert post not working
- Can’t use updated variables in handle function
- How does one add numbers to an admin menu?