starter-theme icon indicating copy to clipboard operation
starter-theme copied to clipboard

home.twig template doesn't exist

Open misfist opened this issue 10 years ago • 1 comments

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.

misfist avatar Nov 29 '15 19:11 misfist

@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.

alenabdula avatar Dec 12 '15 15:12 alenabdula