Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Last active December 23, 2015 08:59
Show Gist options
  • Save dbernar1/6611284 to your computer and use it in GitHub Desktop.
Save dbernar1/6611284 to your computer and use it in GitHub Desktop.
get_template_part() vs. require - variable scope
<?php
$hello = 'world';
get_template_part( 'hello' );
require 'hello.php';
function get_template_part( $filename ) {
require $filename . '.php';
}
Hello, <?php echo $hello ?>
Hello,
Hello, world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment