New answers tagged include
While there are some WP–specific solutions that track template files, for complicated projects pretty much the only reliable list is using get_included_files() PHP function at the end of page load. It would give you everything, including WP core, but filtering it down to theme is relatively easy.
This is essentially scope visibility issue. include brings code into a current scope, function call creates new closed off scope. In get_template_part() only certain WordPress globals are being made available by load_template() call inside. While the basic answer is to declare your variables as globals, you might want to ponder your overall architecture a ...
Top 50 recent answers are included