Skip to content

Fix Home (front-page) template selection #59

@Plou

Description

@Plou
$templates = array(
    'Templates/page-' . $post->post_name . '.twig',
    'Templates/page.twig',
    'Templates/singular.twig',
    'Templates/index.twig');

if ( is_home() || is_front_page()) {
    $context['posts'] = Timber::get_posts('post_type = post');

    array_unshift( $templates, 'Templates/front-page.twig', 'Templates/home.twig' );
}

Timber::render($templates, $context );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions