Link to home
Start Free TrialLog in
Avatar of steva
steva

asked on

Finding the template used to build a WordPress page.

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
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

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">
Avatar of steva
steva

ASKER

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
Appearance | Editor
Avatar of steva

ASKER

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.
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.
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
Avatar of steva

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial