From 91fd930a26f523ca978b21fcaeda8561458a6dad Mon Sep 17 00:00:00 2001 From: Erik van der Bas Date: Mon, 20 May 2024 13:19:50 +0200 Subject: [PATCH] fix: fix paths to twig files --- 404.php | 3 ++- archive.php | 33 ++++++++++++++-------------- author.php | 2 +- index.php | 4 ++-- page.php | 2 +- search.php | 2 +- single.php | 7 +++--- views/partials/tease-post.twig | 2 +- views/partials/tease.twig | 2 +- views/templates/404.twig | 2 +- views/templates/archive.twig | 2 +- views/templates/author.twig | 2 +- views/templates/index.twig | 2 +- views/templates/page.twig | 2 +- views/templates/search.twig | 4 ++-- views/templates/single-password.twig | 2 +- views/templates/single.twig | 2 +- 17 files changed, 39 insertions(+), 36 deletions(-) diff --git a/404.php b/404.php index e56dea257..8d841c733 100644 --- a/404.php +++ b/404.php @@ -1,4 +1,5 @@ name(); } -Timber::render( array( 'author.twig', 'archive.twig' ), $context ); +Timber::render( array( 'templates/author.twig', 'templates/archive.twig' ), $context ); diff --git a/index.php b/index.php index 30dd82f4d..4d2577055 100644 --- a/index.php +++ b/index.php @@ -16,8 +16,8 @@ $context = Timber::context(); $context['posts'] = Timber::get_posts(); $context['foo'] = 'bar'; -$templates = array( 'index.twig' ); +$templates = array( 'templates/index.twig' ); if ( is_home() ) { - array_unshift( $templates, 'front-page.twig', 'home.twig' ); + array_unshift( $templates, 'templates/front-page.twig', 'templates/home.twig' ); } Timber::render( $templates, $context ); diff --git a/page.php b/page.php index 256fb9d11..3a5c7cf06 100644 --- a/page.php +++ b/page.php @@ -25,4 +25,4 @@ $timber_post = Timber::get_post(); $context['post'] = $timber_post; -Timber::render( array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context ); +Timber::render(array('templates/page-' . $timber_post->post_name . '.twig', 'templates/page.twig'), $context); diff --git a/search.php b/search.php index 069b3aae7..4bc0e9184 100644 --- a/search.php +++ b/search.php @@ -9,7 +9,7 @@ * @since Timber 0.1 */ -$templates = array( 'search.twig', 'archive.twig', 'index.twig' ); +$templates = array( 'templates/search.twig', 'templates/archive.twig', 'templates/index.twig' ); $context = Timber::context(); $context['title'] = 'Search results for ' . get_search_query(); diff --git a/single.php b/single.php index e47be9045..d1a0014fa 100644 --- a/single.php +++ b/single.php @@ -1,4 +1,5 @@ ID ) ) { - Timber::render( 'single-password.twig', $context ); +if (post_password_required($timber_post->ID)) { + Timber::render('single-password.twig', $context); } else { - Timber::render( array( 'single-' . $timber_post->ID . '.twig', 'single-' . $timber_post->post_type . '.twig', 'single-' . $timber_post->slug . '.twig', 'single.twig' ), $context ); + Timber::render(array('templates/single-' . $timber_post->ID . '.twig', 'templates/single-' . $timber_post->post_type . '.twig', 'templates/single-' . $timber_post->slug . '.twig', 'templates/single.twig'), $context); } diff --git a/views/partials/tease-post.twig b/views/partials/tease-post.twig index 1194c0131..5a08767e0 100644 --- a/views/partials/tease-post.twig +++ b/views/partials/tease-post.twig @@ -1,4 +1,4 @@ -{% extends 'tease.twig' %} +{% extends 'partials/tease.twig' %} {% block content %}

{{ post.title }}

diff --git a/views/partials/tease.twig b/views/partials/tease.twig index cbedb7570..1a0f7b078 100644 --- a/views/partials/tease.twig +++ b/views/partials/tease.twig @@ -6,4 +6,4 @@ {% endif %} {% endblock %} - + \ No newline at end of file diff --git a/views/templates/404.twig b/views/templates/404.twig index 527b62201..1b2073c67 100644 --- a/views/templates/404.twig +++ b/views/templates/404.twig @@ -1,4 +1,4 @@ -{% extends 'base.twig' %} +{% extends 'layouts/base.twig' %} {% block content %} Sorry, we couldn't find what you're looking for. diff --git a/views/templates/archive.twig b/views/templates/archive.twig index c5c46f60e..7e555ded7 100644 --- a/views/templates/archive.twig +++ b/views/templates/archive.twig @@ -1,7 +1,7 @@ {# This file demonstrates using most of the index.twig template and modifying just a small part. See `search.twig` for an example of another approach #} -{% extends 'index.twig' %} +{% extends 'templates/index.twig' %} {% block content %}

This is my archive

diff --git a/views/templates/author.twig b/views/templates/author.twig index 85a7a1867..6d1976125 100644 --- a/views/templates/author.twig +++ b/views/templates/author.twig @@ -1,4 +1,4 @@ -{% extends 'base.twig' %} +{% extends 'layouts/base.twig' %} {% block content %} {% for post in posts %} diff --git a/views/templates/index.twig b/views/templates/index.twig index 91ff1dcdd..b68fbd716 100644 --- a/views/templates/index.twig +++ b/views/templates/index.twig @@ -1,4 +1,4 @@ -{% extends 'base.twig' %} +{% extends 'layouts/base.twig' %} {% block content %}

{{ foo }}

diff --git a/views/templates/page.twig b/views/templates/page.twig index 1cac131f0..7709c526c 100644 --- a/views/templates/page.twig +++ b/views/templates/page.twig @@ -1,4 +1,4 @@ -{% extends 'base.twig' %} +{% extends 'layouts/base.twig' %} {% block content %}
diff --git a/views/templates/search.twig b/views/templates/search.twig index bd029d4f5..f8853a60e 100644 --- a/views/templates/search.twig +++ b/views/templates/search.twig @@ -1,5 +1,5 @@ -{# see `archive.twig` for an alternative strategy of extending templates #} -{% extends 'base.twig' %} +{# see `templates/archive.twig` for an alternative strategy of extending templates #} +{% extends 'layouts/base.twig' %} {% block content %}
diff --git a/views/templates/single-password.twig b/views/templates/single-password.twig index 52a3076a2..e239629b7 100644 --- a/views/templates/single-password.twig +++ b/views/templates/single-password.twig @@ -1,4 +1,4 @@ -{% extends 'base.twig' %} +{% extends 'layouts/base.twig' %} {% block content %}