<?php

use Timber\Timber;

$context         = Timber::context();
$timberPost      = Timber::get_post();
$context['post'] = $timberPost;

if (!$timberPost) {
    Timber::render('pages/404.twig', $context);
    return;
}

if (post_password_required($timberPost->ID)) {
    Timber::render('pages/single-password.twig', $context);
    return;
}

Timber::render([
    'pages/page-' . $timberPost->ID . '.twig',
    'pages/page-' . $timberPost->post_name . '.twig',
    'pages/page.twig',
], $context);
