-
-
Save tenman/1488546 to your computer and use it in GitHub Desktop.
include on template files
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
Can I use PHP include function on the template files? | |
Reason why | |
example.php | |
hello<?php | |
$var = "World"; | |
function hello_world(){ | |
return "world"; | |
} | |
?> | |
header.php | |
<?php | |
require("example.php");/* or */ echo get_template_part('example'); | |
echo $var; | |
echo hello_world(); | |
?> | |
use require display hello Worldworld | |
use get_template_part('example') display hello world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment