Is there any way to see what .php files are being loaded for a particular page?

So say I have a page – www.example.com/page – and on it is loading the header.php, sidebar.php, footer.php, and the page.php, and any other php from plugins. Is there anyway to get a list of these for a certain page?

2 Answers
2

The following will show the current template file to logged in admins only. If you add to the top of your functions file, you should see this info as the first line.

add_action('wp_head', 'show_template');

function show_template() {
  global $template;
  global $current_user;
  get_currentuserinfo();
  if ($current_user->user_level == 10 ) print_r($template);
}

You will still need to follow the logic of the page template to determine which header, sidebar and footer are loaded, however.

Leave a Reply

Your email address will not be published. Required fields are marked *