forked from jeffstacey/swa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-reader.php
93 lines (60 loc) · 1.82 KB
/
page-reader.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
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
<?php
/**
* Description of Template goes here
*
Template Name: Page
*/
?>
<?php get_header(); ?>
<div id="intro" <?php post_class(); ?>>
<!-- <header class="fact-header"> -->
<!-- <h1><?php the_title(); ?></h1> -->
<!-- </header> -->
<?php // the_content(); ?>
<?php get_template_part('part.reader'); ?>
</div>
</div>
<div id="aside">
<?php
// Get fact sheet
query_posts(array(
'post_type' => 'tax',
'subject' => get_queried_object()->slug,
'posts_per_page' => 1,
));
while (have_posts()) : the_post();
$output['pdf'] = get_post_meta(get_the_id(), 'pdf_url', true);
$output['toc'] = get_post_meta(get_the_id(), 'table_of_contents', true);
$output['toc'] = do_shortcode($output['toc']);
ob_start();
?>
<?php
$output['sidebar'] = ob_get_clean();
endwhile;
wp_reset_query();
?>
<?php
$term = get_queried_object();
$myDocumentationPost = get_posts("post_type=page&type=documentation&subject={$term->slug}");
$myDocumentationUrl = get_permalink($myDocumentationPost[0]);
// print_r($myDocumentationPost);
// $myDocumentation = $myDocumentation[0]->post_content;
// $pdf_url = get_post_meta($tax_id, 'pdf_url', true);
?>
<h1><?php the_title(); ?></h1>
<a href="<?php echo $output['pdf']; ?>" class="button-link blocky"><i class="ss-icon">download</i> Download chapter</a>
<a href="<?php echo get_term_link(get_queried_object()); ?>" class="button-link blocky"><i class="ss-icon">piechart</i> View <span>charts</span></a>
<a href="<?php echo $myDocumentationUrl; ?>" class="blocky">Documentation and methodology</a>
<div class="chaptertoc">
<?php // the_content(); ?>
<?php if ($output['toc']) { ?>
<h2>
<em>Chapter contents</em>
</h2>
<?php echo $output['toc']; ?>
<?php } ?>
</div>
<?php
?>
</div>
<?php get_footer(); ?>