As I understand, index.php (a required template) is used when a more specific template is unavailable—according to the template hierarchy.
My question is, if I create all the specific templates that my theme uses (e.g., home.php, single.php, page.php, search.php, archive.php, 404.php, etc…), then why bother writing any markup in index.php at all? I might as well just leave it blank? Is there a reason to fill out index.php?
WordPress might extend the existing template hierarchy in a future version. Your users would get a blank page after an upgrade. So write at least the basic loop, header, footer and pagination.
Another point: I use and see at the
index.php
usually as the default template. I treat its layout as the core concept and all other templates as specialized variations. Your theme will be easier to understand if you build a completeindex.php
that doesnât look like a forgotten stepchild.