Created
June 2, 2023 03:13
-
-
Save anisur2805/f1d04306a3a62c88b9ea4f6982e1e12c to your computer and use it in GitHub Desktop.
Create a page template from plugin, sometimes we need to add a page template from our own plugin, this code will help to create.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function custom_template_include($template) { | |
if (is_page('test')) { // your desiger page | |
$new_template = IC_CORE_PATH . '/templates/custom-template.php'; // your desier file | |
if (file_exists($new_template)) { | |
return $new_template; | |
} | |
} | |
return $template; | |
} | |
add_filter('template_include', 'custom_template_include'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment