Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

justinw
justinw
14,517 Points

Identify Wordpress Page in Inspector

I'm utilizing Firefox to inspect pages within my Wordpress site to know where to customize CSS within a theme that I'm using.

Right now, I'm struggling to identify which PHP page is being used when inspecting. Is there a way to identify this?

4 Answers

Hi Justin,

If you you have body_class set in the body tag you should see the template in use displayed as a class, e.g. page-template-default.

Failing that, for testing, I tend to drop a little text in to home.php, page.php, etc. so that if it displays on the page I can identify which is being used.

Hope that helps.

-Rich

Tim Knight
Tim Knight
28,888 Points

To add to Rich's suggestions if all else fails, sometimes I'll install a plugin called "What the File" which adds the name of the rendered template into the admin bar.

https://wordpress.org/plugins/what-the-file/

Good suggestion. Zac covered this in one of his videos (although it may have been one that has since been replaced with an updated version - can't remember which).

-Rich

Kevin Korte
Kevin Korte
28,148 Points

To echo Rich, I just drop in little comment at the beginning of the file so when you inspect in the developer mode, that comment will be in the markup.

justinw
justinw
14,517 Points

Guys this feedback is phenomenal. Thank you all so much for these informative responses.

No problem. Glad you found them useful :)

-Rich