-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-guide.php
More file actions
175 lines (97 loc) · 5.48 KB
/
single-guide.php
File metadata and controls
175 lines (97 loc) · 5.48 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php get_header('toolkits');
// note change
global $post;
?>
<?php while ( have_posts() ) : the_post(); $postid = get_the_ID(); ?>
<article class="toolkit-guide" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Display featured image in right-aligned floating div -->
<p id="show-for-mobile"><a href="/toolkit-navigator/">Toolkit Navigator</a></p>
<section id="guide-header">
<h1 class="guide-title"><?php the_title(); ?></h1>
<p id="skip-for-mobile"><a href="#guide-related-header">Scroll to toolkits</a></p>
</section>
<section id="guide-main-content" class="guide-page-content wpb_column vc_column_container col-md-8 vc_col-sm-12">
<?php the_content(); ?>
</section>
<section id="guide-sidebar" class="guide-page-content wpb_column vc_column_container col-md-4 vc_col-sm-12">
<section id="referral-section" class="toolkit-section col-md-12 col-sm-12 col-xs-12">
<div class="row">
<div class="referral-box meta-column col-md-12 col-xs-12">
<div id="cases-referral-block" class="referral-block">
<h5>The OPSI community has experts in this area</h5>
<p><a href="/about-observatory-of-public-sector-innovation/about-our-in-country-contacts/">Connect with them</a></p>
</div>
</div>
<div class="referral-box meta-column col-md-12 col-xs-12">
<div id="cases-referral-block" class="referral-block">
<h5>See how other governments are doing this work</h5>
<p><a href="/our-work/case-studies/">Go to case studies</a></p>
</div>
</div>
</div>
<?php
$currentID = get_the_ID();
$disciplines = get_field('guide_discipline_or_practice');
if( $disciplines ):
foreach( array_reverse($disciplines) as $discipline ):
$disciplineSlug = $discipline->name;
endforeach;
endif;
$disciplineUpper = ucwords($disciplineSlug);
$disciplineLower = strtolower($disciplineSlug);
$disciplineHyphenated = str_replace(' ', '-', $disciplineLower);
?>
<h2 id="guide-related-header"><?php echo $disciplineUpper ?> toolkits</h2>
<?php
$args = array(
'post_type' => 'toolkit',
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'discipline-or-practice',
'field' => 'slug',
'terms' => $disciplineSlug // current discipline or practice
)
),
'posts_per_page' => 6,
);
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="related-toolkits-item guides-related-item col-md-12 col-sm-12 col-xs-12">
<div class="guide-sidebar-image-box">
<a href="
<?php echo the_permalink() ?>" class="toolkit-list-image">
<?php echo get_the_post_thumbnail(get_the_ID(), 'medium'); ?>
</a>
</div>
<h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
<?php
$publishers = get_field('publisher');
if( $publishers ): ?>
<?php foreach( $publishers as $publisher ): ?>
<h4>
<?php echo $publisher->name; ?>
</h4>
<?php endforeach; ?>
<?php endif; ?>
<p><?php the_field('description'); ?></p>
</div> <!-- result item -->
<?php
endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p>We're working on adding more toolkits in this discipline or practice.</p>
<?php endif; ?>
<h2 class="view-all-link"><a href="/search-toolkits/?_sft_discipline-or-practice=<?php echo $disciplineHyphenated ?>">View all toolkits for <?php echo $disciplineUpper ?></a></h2>
</section>
</section>
<section id="another-section" class="browse-page-content category-row wpb_column vc_column_container col-md-12 vc_col-sm-12">
</section>
</article>
<?php // comments_template(); ?>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>