-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathattachment.php
More file actions
39 lines (35 loc) · 971 Bytes
/
attachment.php
File metadata and controls
39 lines (35 loc) · 971 Bytes
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
<?php
/**
* The template for displaying all single attachments
*
* https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage MGPress
* @version 1.0
* @since MGPress 1.0
* @author kchevalier@mindgruve.com
*/
// set context
$context = Timber::get_context();
$post = Timber::query_post();
$context['post'] = $post;
// get mimetype
list($mimetype, $subtype) = explode('/', get_post_mime_type($post->ID));
// render views
if (post_password_required($post->ID)) {
Timber::render('detail/password.twig', $context);
} else {
Timber::render(
array(
'detail/' . $mimetype . '-' . $subtype . '.twig',
'detail/' . $subtype . '.twig',
'detail/' . $mimetype . '.twig',
'detail/attachment.twig',
'detail/post.twig',
'detail/single.twig',
'index.twig'
),
$context
);
}