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
WordPress

Avatar of undefined
Last Comment
Jason C. Levine

8/22/2022 - Mon
Jason C. Levine

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">
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
Jason C. Levine

Appearance | Editor
Your help has saved me hundreds of hours of internet surfing.
fblack61
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.
Jason C. Levine

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.
eemit

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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
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
Jason C. Levine

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.