timber / starter-theme

The "_s" for Timber: a dead-simple theme that you can build anything from
MIT License
818 stars 277 forks source link

home.twig template doesn't exist #11

Closed misfist closed 9 months ago

misfist commented 8 years ago

index.php contains the following:

$templates = array( 'index.twig' );
if ( is_home() ) {
    array_unshift( $templates, 'home.twig' );
}

So, if the current page is the home page, home.twig should be added in front of index.twig in the $template array, yet there is no home.twig template included.

alenabdula commented 8 years ago

@misfist

array_unshift() - prepends passed elements to the front of the array. php.net

If there's no home.twig template it will default to index.twig. Think of the $templates array as fallback list of templates. This starter theme is just emulating what WordPress already does if you review WordPress Template Hierarchy.