I’ve taken over the maintainance of a large WP-MS powered site. The site has ~200 templates, many page specific, and with no standard naming procedure.
It would save a lot of time if while surfing around the site I can see the template names which make up the current page. Is this possible? I’ve looked at the debug plugins for WordPress, but they appear geared towards variables and SQL queries, not templates.
this is also a quick way;
paste it just before the closing tag
I use this to simply print the template filename at the top of the page for debugging purposes.
The following functions do 3 things:
*) Attach it to the content filter. You may need to play with the conditional or capability depending on your role. So far I don’t know a solution to show the page template for archives and similar list view requests.
While not directly an answer to the question at hand, it should probably also be noted here that by default WordPress adds a class name to the
<body>
tag for custom page templates. So for instance, if you are viewing a page that has a custom page template, and the template’s filename is custom.php, then a class name ofpage-template-custom
will be added to the<body>
tag.Documentation on this feature can be found here:
https://codex.wordpress.org/Function_Reference/body_class#Page