In PHP, when you include
a file, the variables you're using in your current scope are available for use in the included file.
When using WordPress's get_template_part()
, variables are no longer available in the "included" file.
get_template_part()
calls locate_template()
which then calls load_template()
, which then performs the require
or require_once
.
If WordPress eventually calls PHP's require
, why do the variables no longer work? Is it something to do with the 3 function calls before the actual require
?