Finding the template used to build a WordPress page.

steva
steva used Ask the Experts™
on
Is there a way to tell from a WordPress page what template the page was built from. In my case, there's a page at mysite.com/checkout and I happen to know that the template used to build this page is at wp-content/plugins/woocommerce/templates/checkout/form-checkout.php. But how could I have known that just from poking around the page with Chrome Dev Tools?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jason C. LevineDon't talk to me.

Commented:
If you have access to the admin login for the site, sure.

From looking at just the front end? You should be able to get a clue from the body class.  This is what one of mine looks like (template bolded for emphasis):

<body class="page page-id-44821 page-parent page-template page-template-template-healthy-sooner page-template-template-healthy-sooner-php desktop custom-header full-width-content no-js">

Author

Commented:
I do have access to the admin login for the site. In that case, where do I find the template for the various pages?

Thanks
Jason C. LevineDon't talk to me.

Commented:
Appearance | Editor
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Author

Commented:
I didn't see and Editor option under Appearance in the Dashboard.

But in any case, thinking more about my question, I don't think it's possible see anything in a browser that will tell you what template was used to build some portion of a page, say a checkout form.  Those templates are all consumed by the PHP and what you see on the browser is the result of following the template instructions.
Jason C. LevineDon't talk to me.

Commented:
I don't think it's possible see anything in a browser that will tell you what template was used to build some portion of a page, say a checkout form

It depends on exactly how the page or application is built.  Some will be as you say, others will use a more straightforward approach like my sample.  It's not a black and white issue.  For WooCommerce, clearly it's the former.

I didn't see and Editor option under Appearance in the Dashboard.

Either you don't have full administrator privileges (e.g. someone messed with the capabilities) or you're logging in as an editor.
Top Expert 2012

Commented:
For custom page templates, you can see page template name (not page template file name) in:
Edit Page Screen / Template or in
Pages / Quick Edit / Template

Author

Commented:
Pages / Quick Edit / Template shows "Default template" for most all my pages but I know that the checkout page, for example, is built from many templates controlling various area of the page and its those templates that I wanted to find.  But as I mentioned above, I don't think this is going to be possible because those templates were "consumed" by PHP to create the page and no trace of them is left by the time the browser displays the results.
Don't talk to me.
Commented:
If the pages are generated from a user action and parsed by a plugin, yes.  You would need to go through the plugin files to determine what's what.  Plugins | Editor might help with this but it traverses folders in a strange way.

Better off to download the plugin folder via FTP and pick it apart that way.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial