forked from Eworm/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
106 lines (71 loc) · 1.94 KB
/
index.php
File metadata and controls
106 lines (71 loc) · 1.94 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
$context = Timber::get_context();
if (is_front_page())
{
$context['post'] = new TimberPost();
$template = ['home.twig'];
}
else if (is_page())
{
$context['post'] = new TimberPost();
$template = ['page.twig'];
}
else if (is_home())
{
$context['post'] = new TimberPost();
$posts_query = array(
'post_type' => 'post',
'orderby' => 'date',
'post_status' => 'publish',
'paged' => $paged
);
$context['posts'] = Timber::get_posts($posts_query);
$context['pagination'] = Timber::get_pagination(4);
// $context['dynamic_sidebar'] = Timber::get_widgets('1');
$template = ['blog.twig'];
}
else if (is_single())
{
$context['post'] = new TimberPost();
// $context['dynamic_sidebar'] = Timber::get_widgets('1');
$template = ['single.twig'];
}
else if (is_post_type_archive())
{
$context['post'] = new TimberPost();
$context['posts'] = Timber::get_posts();
$template = ['archive.twig'];
}
else if (is_category())
{
$context['post'] = new TimberPost();
$context['posts'] = Timber::get_posts();
$context['title'] = single_cat_title('', false);
$template = ['category.twig'];
}
else if (is_tag())
{
$context['post'] = new TimberPost();
$context['posts'] = Timber::get_posts();
$context['title'] = single_cat_title('', false);
$template = ['tag.twig'];
}
else if (is_search())
{
$context['post'] = new TimberPost();
$context['posts'] = Timber::get_posts();
$context['pagination'] = Timber::get_pagination(4);
$context['searchterm'] = get_search_query();
$template = ['search.twig'];
}
else if (is_author())
{
$context['author'] = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
$template = ['author.twig'];
}
else if (is_404())
{
$template = ['errors/404.twig'];
}
Timber::render($template, $context);
?>