Last updated May 2020 for WordPress 5.4.
Did you know that the
index.php file in a WordPress theme can be empty? There’s no need for it to contain anything at all, as long as you have the following template files in place:
When I build a theme from scratch, I make sure it includes at least these files. That means the
index.php file will never get loaded, and I can put my beautiful ASCII WordPress template hierarchy diagram in it instead.
You should also use my Query Monitor plugin to view the actual hierarchy used to select the template for any given request, which makes working with the template hierarchy much easier.