is there a simple way to list every templates / php files used to generate a specific page?

To customize a theme , it is not always easy to trace every files that are used and find out which one do what .
For example i’ like to find out how my menu is generated so i can add some conditions to it , and also change the display.
Is there a way to find out all the files loaded ? which header is used …etc…
maybe put a bit of code somewhere in the autoload sytem? or using firebug?

2 Answers
2

WordPress does not really track what theme files are loaded beyond some basic things (for example $template global holds main template file).

You can use PHP’s native get_included_files() to list all PHP source files loaded during request and narrow it down to your theme. Note that for more complex themes this will have not only templates, but likely a lot of framework files as well.

Leave a Comment