forked from EarthJournalismNetwork/jeo-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content-page-vertical.php
executable file
·259 lines (250 loc) · 11 KB
/
content-page-vertical.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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<?php
/*
Template Name: Content Page Vertical
*/
get_header(); ?>
<?php if(have_posts()) : the_post(); ?>
<?php
wp_reset_query();
$topic = wp_get_post_terms($id, 'topic', array('fields' => 'all'));
$topic_name = $topic[0]->name;
$topic_desc = $topic[0]->description;
$region = wp_get_post_terms($id, 'region', array('fields' => 'all'));
$region_name = $region[0]->name;
$region_desc = $region[0]->description;
$pub_type = wp_get_post_terms($id, 'pub_type', array('fields' => 'all'));
$pub_type_name = $pub_type[0]->name;
$pub_type_desc = $pub_type[0]->description;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 10,
'paged' => $paged,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => array('post', 'link', 'sequence'),
'post_status' => 'publish',
'suppress_filters' => true,
'region' => $region_name,
'topic' => $topic_name,
'pub_type' => $pub_type_name
);
global $wp_query;
$wp_query = new WP_Query( $args );
$map_id = get_post_meta( $post->ID, 'map_id', true);
$pub_name = get_post_meta( $id, 'pub_name' , true );
$source_link = get_post_meta( $id, 'source_link', true );
if ($pub_name != '' and $source_link != '') {
$pub_name = '<a href="' . $source_link . '">' . $pub_name . '</a>';
} else {
$pub_name = '';
}?>
<div class="main">
<a name="content"></a>
<div class="section-list">
<header class="section-header">
<h1><?php echo $topic_name, $region_name, $pub_type_name; ?></h1>
<h2 class="subhead"><?php echo $topic_desc, $region_desc, $pub_type_desc; ?></h2>
</header>
<div id="main-map" <?php post_class('stage-map'); ?>>
<?php jeo_map($map_id); ?>
<section id="last-stories" class="loop-section">
<div class="section-title">
<div class="query-actions">
<?php
global $wp_query;
$args = $wp_query->query;
$args = array_merge($args, $_GET);
$geojson = jeo_get_api_url($args);
$download = jeo_get_api_download_url($args);
$rss = add_query_arg(array('feed' => 'rss'));
?>
<a class="rss" href="<?php echo $rss; ?>"><?php _e('RSS Feed', 'ekuatorial'); ?></a>
<a class="geojson" href="<?php echo $geojson; ?>"><?php _e('Get GeoJSON', 'ekuatorial'); ?></a>
<a class="download" href="<?php echo $download; ?>"><?php _e('Download', 'ekuatorial'); ?></a>
<a class="share-button" href="<?php echo jeo_get_share_url(array('map_id' => $post->ID)); ?>"><?php _e('Embed this map', 'ekuatorial'); ?></a>
<div class="fb-like" data-href="<?php the_permalink(); ?>" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-font="verdana" data-action="recommend"></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="MekongEye" data-lang="<?php if(function_exists('qtranxf_getLanguage')) echo qtranxf_getLanguage(); ?>">Tweet</a>
</div>
</div>
</section>
</div>
<div class="sv-slice">
<?php foreach ( $wp_query->posts as $post ) { ?>
<article class="sv-story">
<?php
if (has_post_thumbnail($post->ID)) {
?>
<div class="sv-story__hd">
<?php
$link = get_post_meta($post->ID, 'link_target', true);
if ($link != '') {
echo '<a href="' . $link .'" target="_blank">';
} else {
echo '<a href="' . post_permalink($post->ID) .'" target="_blank">';
}
$thumbnail = get_the_post_thumbnail( $post->ID );
echo $thumbnail;
?>
</a>
</div>
<?php
}
?>
<div class="sv-story__bd">
<?php
$kicker = wp_get_post_terms($post->ID, 'pub_type', array('fields' => 'names'));
if ($kicker[0] != '') {
?>
<p class="kicker"><?php echo $kicker[0]; ?></p>
<?php
}
?>
<h2>
<?php
$link = get_post_meta($post->ID, 'link_target', true);
if ($link != '') {
echo '<a href="' . $link .'" target="_blank">';
} else {
echo '<a href="' . post_permalink($post->ID) .'" target="_blank">';
}
?><?php echo $post->post_title ?></a>
</h2>
<?php
$date = get_post_meta( $post->ID, 'date', true);
if ($date == '') {
$date = get_the_date( 'j M Y', $post->ID );
}
?>
<p class="dateline"><?php echo $date ?></p>
<?php
$pub_name = get_post_meta( $post->ID, 'pub_name' , true );
$source_link = get_post_meta( $post->ID, 'source_link', true );
if ($pub_name != '' and $source_link != '') {
$pub_name = '<a href="' . $source_link . '" target="_blank">' . $pub_name . '</a>';
} else {
$pub_name = '';
}
?>
<p class="source"><?php echo $pub_name ?></p>
</div>
<div class="sv-story__ft">
<?php
echo $post->post_excerpt;
$custom_link_text = get_post_meta( $post->ID, 'custom_link_text', true);
if ($custom_link_text == '') {
$custom_link_text = 'read more';
}
?>
<p class="more">
<?php
$link = get_post_meta($post->ID, 'link_target', true);
if ($link != '') {
echo '<a href="' . $link .'" target="_blank">';
} else {
echo '<a href="' . post_permalink($post->ID) .'">';
}
echo $custom_link_text;
?>
»</a>
</p>
</div>
</article>
<?php } ?>
</div>
<?php
$query = new WP_Query($args);
echo paginate_links( array(
'base' => '%_%',
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $query->max_num_pages
) );
?>
</div>
<div id="stories-right">
<section class="sc-container" id="recent">
<h2 class="alt">News Stream</h2>
<div class="sc-slice size-xs">
<?php
$args = array(
'posts_per_page' => 10,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => array('post', 'link', 'sequence'),
'post_status' => 'publish',
'suppress_filters' => true
);
$posts = get_posts( $args );
foreach ( $posts as $post ) {
$author_name = get_post_meta( $post->ID, 'author_name', true );
?>
<article class="sc-story">
<?php
$link = get_post_meta($post->ID, 'link_target', true);
if ($link != '') {
echo '<a href="' . $link .'" target="_blank">';
}
else {
echo '<a href="' . post_permalink($post->ID) .'">';
}
?>
<div class="sc-story__bd">
<?php
$kicker = wp_get_post_terms($post->ID, 'pub_type', array('fields' => 'names'));
$pub_name = get_post_meta( $post->ID, 'pub_name', true);
?>
<h4><?php echo ($kicker[0] == '' ? '' : '<b class="kicker">' . $kicker[0] . '</b> ');?> <?php echo $post->post_title; ?> <em><?php echo $pub_name;?></em></h4>
</div>
</a>
</article>
<?php
}
?>
</div>
</section>
<section class="sc-container" id="editor">
<h2 class="alt">Editor’s Picks</h2>
<div class="sc-slice size-xs">
<?php
$args = array(
'posts_per_page' => 10,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => array('post', 'link', 'sequence'),
'post_status' => 'publish',
'meta_key' => 'editor_pick',
'meta_value' => "true",
'suppress_filters' => true
);
$posts = get_posts( $args );
foreach ( $posts as $post ) {
$author_name = get_post_meta( $post->ID, 'author_name', true );
?>
<article class="sc-story">
<?php
$link = get_post_meta($post->ID, 'link_target', true);
if ($link != '') {
echo '<a href="' . $link .'" target="_blank">';
}
else {
echo '<a href="' . post_permalink($post->ID) .'">';
}
?>
<div class="sc-story__bd">
<?php
$kicker = wp_get_post_terms($post->ID, 'pub_type', array('fields' => 'names'));
$pub_name = get_post_meta( $post->ID, 'pub_name', true);
?>
<h4><?php echo ($kicker[0] == '' ? '' : '<b class="kicker">' . $kicker[0] . '</b> ');?> <?php echo $post->post_title; ?> <em><?php echo $pub_name;?></em></h4>
</div>
</a>
</article>
<?php
}
?>
</div>
</section>
</div>
</div>
<?php endif; ?>
<?php get_footer(); ?>