/
archive-multimedia.php
executable file
·339 lines (210 loc) · 12.9 KB
/
archive-multimedia.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<?php get_header();
$post_type = get_post_type();
if ( $post_type == "article_news" ) {
$cat_id = 4;
} elseif ( $post_type == "article_sports" ) {
$cat_id = 10;
} elseif ( $post_type == "article_living" ) {
$cat_id = 11;
} elseif ( $post_type == "article_ae" ) {
$cat_id = 2341;
} elseif ( $post_type == "article_opinion" ) {
$cat_id = 5;
} elseif ( $post_type == "multimedia" ) {
$cat_id = 194;
} elseif ( $post_type == "slideshows" ) {
$cat_id = 39;
}
?>
<div id="content">
<div id="inner-content" class="wrap clearfix">
<div id="main" class="twelvecol first clearfix" role="main">
<h1 class="single-section-name archive-main-title" class="first last twelvecol"><?php post_type_archive_title(); ?>
<?php if ( is_post_type_archive() ) : ?>
<span class="archive-breadcrumb"><?php
if ( is_year() || is_day() || is_month() ) { ?>
/ archive / <?php the_time('Y'); }
if ( is_day() || is_month() ) { ?>
/ <?php the_time('F'); }
if ( is_day() ) { ?>
/ <?php the_time('d'); } ?></span>
<?php endif; ?>
</h1>
<?php // no reason to change this stuff
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$cat_link = get_category_link($cat_id);
$top_article_class = 'top-' . $post_type;
// set class to first or last depending on position in three column layout
// http://wordpress.org/support/topic/adding-different-styling-every-3rd-post
$style_classes = array('first', '', 'last');
$styles_count = count($style_classes);
$style_index = 0;
// sets up counter for grid row divs in mgallery main
$row_count = 1;
// sets up counter to display first post differently (see TOP ARTICLE)
$firstpost = 'firstpost'; ?>
<?php
if ( !is_paged() ) { ?>
<div id="multimedia-mgallery" class="mgallery ninecol last clearfix">
<div id="post-type-loop-top" class="multimedia-mgallery-top article-container clearfix">
<?php // begin the loop, generated by the gd cpt plugin
if (have_posts()) : while (have_posts()) : the_post();
if ( $firstpost == 'firstpost' ) { ?>
<?php $firstpost = ''; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'top-multimedia-article clearfix' ); ?> role="article">
<?php
// Get the video URL
$videoID = function_exists('get_field') ? get_field('video_link') : get_post_meta($post->ID, 'video_link', true);
// Check if there is in fact a video URL
if ($videoID) {
// Echo the embed code via oEmbed
echo wp_oembed_get( $videoID );
} ?>
<header class="clearfix">
<div class="post-category-list-container"><?php the_category_but( $cat_id ); ?></div>
<h2 class="multimedia-headline multimedia-top-headline headline top-headline"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p class="multimedia-byline byline"><?php _e("by", "zombietheme"); ?> <span class="multimedia-authors authors"><?php if(function_exists('coauthors_posts_links')) coauthors_posts_links(); else the_author_posts_link(); ?></span></p>
<time datetime="<?php the_time('c'); ?>" pubdate><?php the_time('d F Y'); ?></time>
</header>
<section class="multimedia-dek media-dek clearfix">
<p class="clearfix"><?php echo get_post_meta($post->ID, 'media_dek', true); ?></p>
</section> <!-- end multimedia-dek -->
</article> <!-- end article -->
<?php } // end first post
endwhile; endif; // close loop
rewind_posts(); // start the loop over again ?>
</div> <!-- end #post-type-loop-top -->
<div id="post-type-loop-main" class="multimedia-mgallery-main">
<div class="mgallery-row clearfix">
<?php // begin the loop again
$firstpost = 'firstpost';
if (have_posts()) : while (have_posts()) : the_post();
if ( $firstpost == 'firstpost' ) {
$firstpost = '';
}
else { // all non-first posts format ?>
<?php
// this is the second part of the operation that determines first or last class based on column divisions. see above.
$k = $style_classes[$style_index++ % $styles_count]; ?>
<div class="article-container fourcol clearfix <?php echo $k ?>">
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<?php if ( has_post_thumbnail() ) : ?>
<div class="video-thumbnail-container">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('zom-landscape-396'); ?></a>
</div>
<?php endif; ?>
<header>
<div class="post-category-list-container"><?php // the_category_but( $cat_id ); ?></div>
<h2 class="multimedia-headline headline"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p class="multimedia-byline byline"><?php _e("by", "zombietheme"); ?> <span class="multimedia-authors authors"><?php if(function_exists('coauthors_posts_links')) coauthors_posts_links(); else the_author_posts_link(); ?></span></p>
<time datetime="<?php the_time('c'); ?>" pubdate><?php the_time( 'd F Y' ); ?></time>
</header>
<section class="multimedia-dek dek">
<p><?php echo get_post_meta($post->ID, 'media_dek', true); ?></p>
</section> <!-- end multimedia-dek -->
</article> <!-- end article -->
</div> <!-- end article-container -->
<?php
if ( $row_count % 3 == 0 && $row_count !== 9 ) {
echo '</div><div class="mgallery-row clearfix">';
} elseif ( $row_count == 9 ) {
echo '</div>';
}
$row_count++;
} // end non-first posts
endwhile; // close while_posts() loop but continue past the pagination area to see the real end
?>
<?php
if (function_exists('bones_page_navi')) { // if experimental feature is active
bones_page_navi(); // use the page navi function
} else { // if it is disabled, display regular wp prev & next links ?>
<nav class="wp-prev-next">
<ul class="clearfix">
<li class="prev-link"><?php next_posts_link(_e('« Older Entries', "zombietheme")) ?></li>
<li class="next-link"><?php previous_posts_link(_e('Newer Entries »', "zombietheme")) ?></li>
</ul>
</nav>
<?php } ?>
<?php else : // if the loop returns nothing ?>
<article id="post-not-found" class="hentry clearfix">
<header class="article-header">
<h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
</header>
<section class="post-content">
<p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
</section>
<footer class="article-footer">
<p><?php _e("This is the error message in the custom posty type archive template.", "bonestheme"); ?></p>
</footer>
</article>
<?php endif; // kill loop ?>
</div> <!-- end #post-type-loop-main -->
</div> <!-- end #multimedia-mgallery -->
<aside id="multimedia-aside" class="threecol first">
</aside>
<?php } // end if !is_paged() ?>
<?php if ( is_paged() ){ ?>
<div id="multimedia-mgallery" class="mgallery ninecol last clearfix">
<div id="post-type-loop-main" class="twelvecol first last clearfix">
<div class="mgallery-row clearfix">
<?php // begin the loop again
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
// this is the second part of the operation that determines first or last class based on column divisions. see above.
$k = $style_classes[$style_index++ % $styles_count]; ?>
<div class="article-container fourcol clearfix <?php echo $k ?>">
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<?php if ( has_post_thumbnail() ) : ?>
<div class="multimedia-thumb mgallery-thumb">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('zom-landscape-396'); ?></a>
</div>
<?php endif; ?>
<header>
<div class="post-category-list-container"><?php // the_category_but( $cat_id ); ?></div>
<h2 class="multimedia-headline headline"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p class="multimedia-byline byline"><?php _e("by", "zombietheme"); ?> <span class="multimedia-authors authors"><?php if(function_exists('coauthors_posts_links')) coauthors_posts_links(); else the_author_posts_link(); ?></span></p>
<time datetime="<?php the_time('c'); ?>" pubdate><?php the_time( 'd F Y' ); ?></time>
</header>
<section class="multimedia-dek dek">
<p><?php echo get_post_meta($post->ID, 'media_dek', true); ?></p>
</section> <!-- end multimedia-dek -->
</article> <!-- end article -->
</div> <!-- end article-container -->
<?php
if ( $row_count % 3 == 0 && $row_count !== 9 ) {
echo '</div><div class="mgallery-row clearfix">';
} elseif ( $row_count == 9 ) {
echo '</div>';
}
$row_count++;
endwhile; // close while_posts() loop but continue past the pagination area to see the real end
if (function_exists('bones_page_navi')) { // if experimental feature is active
bones_page_navi(); // use the page navi function
} else { // if it is disabled, display regular wp prev & next links ?>
<nav class="wp-prev-next">
<ul class="clearfix">
<li class="prev-link"><?php next_posts_link(_e('« Older Entries', "zombietheme")) ?></li>
<li class="next-link"><?php previous_posts_link(_e('Newer Entries »', "zombietheme")) ?></li>
</ul>
</nav>
<?php } ?>
<?php else : // if the loop returns nothing ?>
<article id="post-not-found" class="hentry clearfix">
<header class="article-header">
<h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
</header>
<section class="post-content">
<p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
</section>
<footer class="article-footer">
<p><?php _e("This is the error message in the custom posty type archive template.", "bonestheme"); ?></p>
</footer>
</article>
<?php endif; // kill loop ?>
</div> <!-- end #post-type-loop-main -->
</div> <!-- end #multimedia-mgallery -->
<?php } // end if is_paged() ?>
</div> <!-- end #main -->
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>