Skip to content

Instantly share code, notes, and snippets.

@tenman
Created December 16, 2011 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenman/1488546 to your computer and use it in GitHub Desktop.
Save tenman/1488546 to your computer and use it in GitHub Desktop.
include on template files
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