-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
47 lines (39 loc) · 1.37 KB
/
single.php
File metadata and controls
47 lines (39 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* The template for displaying single posts and pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Tenth_Template
* @since Tenth Template 1.0
*/
use Timber\Timber;
use tp\TenthTemplate\Post;
use tp\TenthTemplate\Exultant;
use tp\TouchPointWP\Involvement;
$context = Timber::context();
require 'commonContext.php';
/** @var Post $timber_post */
$timber_post = Timber::get_post();
$context['post'] = $timber_post;
// Password required.
if (post_password_required($timber_post->ID)) {
Exultant::render('single-password.twig', $context);
} else {
$context['object'] = $timber_post->toObject();
$templates = [
'templates/single-' . $timber_post->ID . '.twig',
'templates/single-' . $timber_post->post_type . '.twig',
'templates/single-' . $timber_post->slug . '.twig',
'templates/single.twig'
];
if (str_starts_with(get_post_type(), "tp_inv_")) {
$settings = Involvement::getSettingsForPostType(get_post_type());
$context['use_geo'] = $settings->useGeo;
$addTemplates[] = "templates/single-" . get_post_type() . ".twig";
$addTemplates[] = "templates/single-tp_inv.twig";
}
$addTemplates[] = 'templates/single-' . get_post_type() . '.twig';
array_unshift( $templates, ...$addTemplates);
Exultant::render($templates, $context );
}