Here’s an early version of a very small plugin I’ve been working on. It shows lots of information about the data available to you on any frontend page in WordPress, including the query terms and whether conditional template tags are true or false.
There are a few plugins available which show you the template you’re currently using, as well as the files the current page uses (like index.php, loop.php, etc.) but for more detailed information, this does the job.
I created it because the theme I’m working on – a base theme for commercial website builds – doesn’t use templates, just an index.php with conditional statements determining what content is presented. So it was often hard to figure out why certain things were or were not showing.
Add to your theme folder then use a PHP include to show the info at the top of your page (so probably in header.php), like so:
<?php include('info.php'); ?>. In my base theme I used Advanced Custom Fields and the ACF Options add-on to create a toggle option for users in the site admin, but a later version of this plugin will let you toggle showing this info via a proper plugin settings page.
Don’t leave this on a commercial website! I’m still learning PHP so the code is probably a bit hacky and could cause issues. If you love what this does, I’d recommend having a go at writing something similar yourself.