-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.php
68 lines (51 loc) · 1.29 KB
/
index.php
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
<?php
/**
* Author: Coby Tamayo
*/
use Timber\Timber;
use Conifer\Post\Page;
//blog page
$newsPage = Page::get_blog_page();
$featurePost = '';
$is_category = false;
$catQuery = '';
if( is_tag() || is_category() ) {
// tag/category archive page
$post = Timber::get_term();
$is_category = true;
$catQuery = get_query_var('cat');
} else {
// regular blog archive
$post = $newsPage;
}
//get archives
//This is not currently in a functioning state to be able to
//filter by archive date
//$archives = new Archives();
//TWIG
/*
<nav class="subnav-filter">
<h3 class="subnav-filter__title">Archives</h3>
<ul class="subnav-filter__menu">
<li><a href="{{ get_blog_url() }}">All</a></li>
{% for archive in archives.items %}
{% for month in archive.children %}
<li><a href="{{ month.link }}">{{ month.name }} {{ archive.name }}</a></li>
% endfor %}
{% endfor %}
</ul>
</nav><!-- //subnav-filter -->
*/
// GET CONTEXT DATA
$data = Timber::context([
'newsPage' => $newsPage,
'post' => $post,
'is_category' => $is_category,
'posts' => Timber::get_posts([
'category__in' => $catQuery,
'paged' => get_query_var('paged'),
]),
//'archives' => $archives
]);
// Render the archive view
Timber::render( 'index.twig', $data );