Skip to content

Commit b5b38d0

Browse files
committed
fix: template routing for single posts
1 parent 64745eb commit b5b38d0

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/php/single-example.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/php/single.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
$context = Timber\Timber::context();
1010
$timber_post = new Timber\Post();
1111
$context['post'] = $timber_post;
12-
$templates = array( 'page-' . $timber_post->post_name . '.twig', 'page.twig' );
12+
$templates = array( 'single-' . $timber_post->post_type . '.twig', 'page.twig' );
1313

1414
render_with_password_protection( $timber_post, $templates, $context );

src/php/views/single-example.twig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% extends "base.twig" %}
2+
3+
{% block content %}
4+
5+
<div class="obj-width-limiter">
6+
<p>This is from the template, not the post.</p>
7+
{{ post.content }}
8+
</div>
9+
10+
{% endblock %}

0 commit comments

Comments
 (0)