Comparing WordPress Page Templates with Views in Statamic
Making sense of the WordPress template hierarchy has a bit of a learning curve; it’s designed to be able to fall back to more generic templates (e.g. “page.php”) when a more specific version might exist with the correct pattern (e.g. “page-{slug}.php”). This applies to pages, posts, category archives, etc. across the board. It’s a powerful pattern, especially when paired with parent/child themes or plugins with customizable templating.
With Statamic, none of that is needed. It uses a simpler View system, where the template can be defined via a field, or a Collection can be configured to use specific templates, and even scaffold them for us at the click of a button.
I published a video on YouTube going comparing the differences. Watch it here:
In short, the gymnastics in ensuring the correct template is being used are greatly reduced with Statamic. And once we get to the actual template, the fields are already available to us - no need to setup the content via the_post()
or something like that within “the loop,” as the WordPress approach requires.
I love keeping things simple, don’t you?