This is the tiniest, most useful blog post ever.
This piece of code has made me look really intelligent more than once in the last few weeks, so it’s only fair I share it… I call it Mother’s little Theme Template Helper.
If you’re wanting to find out exactly which template the page you’re looking at is being built from, paste this little piece of code in your functions file
This will print the url of the appropriate template in the head of your page so you know exactly which one you should be editing. Or, it will help you figure out where you’re going wrong in your template hierarchy if the template url being displayed is not the one you think it should be.
If you need help on the template hierarchy front, check out the Codex, and believe me, the more you play around with these things the more that codex page makes sense, I confess, it took a while to sink in, but with the codex, and that handy dandy little code above, naming and accessing templates is now smooth sailing around here.