Determine which template-{slug}.php is being loaded

Using body_class() on the body tag would probably be the easiest way to tell which template is in use.

<body <?php body_class(); ?>>

Depending on which page you are on, it will output similar to this

<body class="page page-id-10 page-template-default logged-in">

Where page-template-default is the template in use. It’s also useful for blog posts and custom post types.

Leave a Comment