-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-issues.php
More file actions
56 lines (44 loc) · 1.34 KB
/
template-issues.php
File metadata and controls
56 lines (44 loc) · 1.34 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
<?php
/**
* Template Name: Issues
*
* @package WordPress
* @subpackage FEDW
* @since FEDW 1.1
*/
if (!class_exists('Timber')){
echo 'Timber not activated. Make sure you activate the plugin in <a href="/wp-admin/plugins.php#timber">/wp-admin/plugins.php</a>';
}
$context = Timber::get_context();
$issue_args = array(
'post_type' => 'issue',
'posts_per_page' => 10,
'post_status' => 'publish'
);
$context['issues'] = Timber::get_posts($issue_args);
// Just want to get a posts from the most recent Issue
// $posts_args = array(
// 'tag' => 'Issue ' . $context['issues'][0]->issue_number,
// // 'tag' => 'issue-#',
// 'posts_per_page' => 10
// );
// get the posts
// $issue_posts = Timber::get_posts($posts_args);
// grab last issue
$context['last_issue'] = $context['issues'][1];
// sort posts by category (but really a custom field)
// $context['sections'] = sort_posts_by_category($issue_posts);
// Issues page shouldn't show author meta info
$context['hide_author'] = true;
// Issues page shouldn't show issue posts
$context['hide_issue_posts'] = true;
// error_log(var_export($context['posts'], true));
// echo "<pre>";
// print_r($context);
// print_r($issue_posts);
// echo "</pre>";
// add sidebar
$context['sidebar'] = Timber::get_sidebar('sidebar.php');
// set template
$templates = array('issues.twig');
Timber::render($templates, $context);