-
Notifications
You must be signed in to change notification settings - Fork 15
/
loop-single.php
executable file
·343 lines (335 loc) · 11.7 KB
/
loop-single.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
340
341
342
343
<?php /* Start loop */ ?>
<?php while (have_posts()): the_post(); ?>
<?php $articleFormats = wp_get_post_terms($post->ID, 'article-format');
$articleFormat = $articleFormats[0]->slug;
if (empty($articleFormat) || $articleFormat === 'normal')
$articleFormat = get_field('db_article_format');
$displayAuthor = true;
$italicHeadline = false;
$displayMugshot = false;
if ($articleFormat) {
switch ($articleFormat) {
case 'brief':
$displayAuthor = false;
break;
case 'column':
$italicHeadline = true;
$displayMugshot = true;
break;
case 'default':
$displayAuthor = !in_array('hide_byline', get_field('db_display_options'));
$italicHeadline = in_array('italic_headline', get_field('db_display_options'));
$displayMugshot = in_array('mugshot', get_field('db_display_options'));
}
}
?>
<?php
foreach (get_the_category() as $cat) {
switch ($cat->name) {
case "Bruin Sights":
the_blog_banner('bruinsights');
break (2);
case "Spotlight":
the_blog_banner('spotlight');
break (2);
case "Timestamp":
the_blog_banner('timestamp');
break (2);
case "Video":
$videoStory = true;
break (2);
case "Idle Thoughts":
the_blog_banner('two-cents-idle-thoughts');
break (2);
case "Political Commentary":
the_blog_banner('two-cents-political-commentary');
break (2);
case "Social Commentary":
the_blog_banner('two-cents-social-commentary');
break (2);
case "Editorials":
$ediboardStory = true;
break (2);
}
if ($cat->slug == "sports-two-cents") {
the_blog_banner('two-cents-sports');
}
}
// Find out if this is a video story
// Expand this to do something better for multimedia/gallery display
$video_story = false;
foreach (get_the_category() as $cat) {
switch ($cat->name) {
case "Video":
$video_story = true;
break (2);
}
}
?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php $customFields = get_post_custom(); ?>
<div class="db-post-headline">
<h1><?php the_headline(); ?></h1>
</div>
<hr>
<?php $subhead = get_post_custom_values('db_subhead');
if (isset($subhead) && $subhead[0] != '') { ?>
<h2 class="subhead"><?php echo $subhead[0]; ?></h2>
<?php } ?>
<div class="row">
<div class="small-7 columns">
<div class="db-byline">
<h4> <?php the_byline(); ?> </h4>
<?php if (get_field('db_article_format') != 'brief') { ?>
</br>
<?php } ?>
<h5> Posted: </h5>
<h5> <?php the_time('F j, Y'); ?></h5>
<h5> <?php the_time('g:i a'); ?></h5>
</div>
</div>
<div class="small-5 columns text-right">
<h4><?php the_category(", "); ?></h4>
<br style="clear:both" />
</div>
</div>
<div class="db-image text-center">
<?php if (has_post_thumbnail() && !$video_story) { ?>
<?php the_post_thumbnail('db-category-full'); ?>
<p class="db-image-caption text-left">
<?php echo get_post(get_post_thumbnail_id($post->ID))->post_excerpt; ?>
<?php
// We don't do media credits like this any more
if (get_the_time('U') < 1391744168) { ?>
<?php the_media_credit_html(get_post_thumbnail_id($post->ID)); ?>
<?php } ?>
</p>
<hr>
<?php } ?>
<?php if ($video_story) { ?>
<div class="db-post-content">
<div class="video-story">
<?php the_content(); ?>
</div><!-- end div.video-story -->
</div>
<?php } ?>
</div>
<div class="row">
<div class="medium-3 columns">
<?php if (!$video_story) { ?>
<div class="row text-center">
<h4 class="small-6 columns">
<a href="https://www.facebook.com/sharer/sharer.php?u=http://dailybruin.com<?php the_permalink(); ?>" target="_blank">
<i class="fa fa-facebook fa-lg"></i> Share
</a>
</h4>
<h4 class="small-6 columns">
<a href="https://twitter.com/share" rel="external" target="_blank" data-via="dailybruin">
<i class="fa fa-twitter fa-lg"></i> Tweet
</a>
</h4>
</div>
<hr>
<?php if ($ediboardStory) { ?>
<div class="ediboard-blurb">
<p>The editorial board is composed of multiple Daily Bruin staff members and is dedicated to publishing informed opinions on issues relevant to students. The board serves as the official voice of the paper and is separate from the newsroom.</p>
</div>
<?php } ?>
<?php } ?>
<p>
<?php
if (get_field('corrections') != '') { ?>
<!-- <b>Correction: </b> -->
<?php echo get_field('corrections') ?>
<?php } ?>
</p>
</div>
<div class="medium-9 columns">
<?php
// if(function_exists('the_audio'))
// the_audio();
?>
<?php if (!empty($customFields['db_infobox'][0])) { ?>
<div class="db-infobox">
<?php echo $customFields['db_infobox'][0];
$numberOfPaws = get_field('db_number_of_paws');
if (isset($numberOfPaws) && intval(ceil($numberOfPaws)) > 0) {
$numf = intval(floor($numberOfPaws));
$numc = intval(ceil($numberOfPaws));
echo '<div class="infobox-paws">';
for ($i = 0; $i < $numf; $i++)
echo '<img src="http://dailybruin.com/images/paws/full.png" />';
if ($numf != $numc)
echo '<img src="http://dailybruin.com/images/paws/half.png" />';
for ($i = $numc; $i < 5; $i++)
echo '<img src="http://dailybruin.com/images/paws/blank.png" />';
echo '</div><!-- end div.infobox-paws -->';
}
?>
</div>
<?php } ?>
<div class="db-post-content">
<?php if (!$video_story) {
the_content();
} ?>
</div>
<!-- Coronavirus Tags -->
<?php if (has_tag(22934)): ?>
<a style="font-size: 0.9rem; font-weight: bold;" href="https://features.dailybruin.com/2020/covid-19/">Follow all of our coronavirus coverage <u>here</u></a>
<?php endif; ?>
<!--<p class="author-contact"> -->
<?php
if (get_field('db_article_format') == 'default' && in_array('hide_author_blurb', get_field('db_display_options'))) {
;
}
elseif (!empty($customFields['db_authoremail'][0]) || get_field('db_article_format') == 'brief') {
if (!empty($customFields['db_authoremail'][0])) {
echo $customFields['db_authoremail'][0];
}
}
elseif (intval(the_date('U', '', '', false)) <= 1361363177) {
;
}
else {
$coauthors = get_coauthors();
$finalAuthorKey = count($coauthors) - 1;
$firstAuthor = true;
foreach ($coauthors as $key => $author) {
$lastAuthor = ($finalAuthorKey == $key);
$lastName = get_the_author_meta('last_name', $author->ID);
$firstName = get_the_author_meta('first_name', $author->ID);
$graduated = get_the_author_meta('graduated', $author->ID);
?>
<!--</p> -->
<!--Author Box -->
<?php
//Author Box Variables
$position = get_the_author_meta('position', $author->ID);
$description = get_the_author_meta('description', $author->ID);
$email = get_the_author_meta('user_email', $author->ID);
if (strpos($email, 'wordpress') !== false) {
$email = false;
}
$twitter = get_the_author_meta('twitter_handle', $author->ID);
?>
<img src="http://dailybruin.com/images/2016/04/doublelines.jpg" />
<div class="author-wrapper">
<div class="row author-box">
<div class="large-12 medium-12 small-12 columns author-title">
<div class="author-header">
<a href="<?php echo get_author_posts_url($author->ID, get_the_author_meta('user_nicename', $author->ID)); ?>">
<?php echo "$firstName $lastName"; ?>
</a>
<?php if ($position) { ?>
|
<? } ?>
</div>
<?php if ($position) { ?>
<div class="author-position"> <?php echo $position ?> </div>
<?php } ?>
</div>
</div>
<div class="bio row">
<?php // Display the columnist's mugshot
if ($displayMugshot && $displayAuthor && false) {
ob_start();
if (function_exists('userphoto')) {
userphoto($author->ID);
}
$thumbnail = ob_get_contents();
$thumbnail_class = "";
ob_end_clean();
if (!empty($thumbnail)) {
?>
<div class="image large-2 small-3 medium-2 columns">
<div class="author-photo"> <?php userphoto($author->ID); ?> </div>
</div>
<?php
} else {
$displayMugshot = false;
?>
</div>
<?php
}
}
?>
<?php if (!$displayMugshot && !$description) { ?>
<div class="description large-12 small-12 medium-12 columns">
<?php } elseif (!$displayMugshot) { ?>
<div class="description large-12 small-12 medium-12 columns">
<?php } ?>
<?php if ($description && $displayMugshot) { ?>
<p class="bio-text-mugshot">
<?php echo $description ?>
</p>
<?php } elseif ($description && $displayMugshot) { ?>
<p class="bio-text">
<?php echo $description ?>
</p>
<?php } elseif ($description) { ?>
<p class="bio-text">
<?php echo $description ?>
</p>
<?php } ?>
<?php if (!$description && !$displayMugshot) { ?>
<!-- Don't make margin so large -->
<div class="row contact-info-wrapper-smaller-margin">
<?php } elseif ($displayMugshot) { ?>
<div class="row contact-info-wrapper-mugshot">
<?php } else { ?>
<div class="row contact-info-wrapper">
<?php } ?>
<?php if ($email || $twitter) { ?>
<div class="contact large-2 medium-2 columns show-for-medium-up">
<p class="contact">contact</p>
</div>
<?php } ?>
<div class="email large-5 medium-5 columns show-for-medium-up">
<?php if ($email) { ?>
<p><span class="entypo-mail"></span>
<a class="author-email-inside" href="mailto:<?php echo "$author->user_email"; ?>">
<?php echo "$author->user_email"; ?>
</a></p>
<?php } ?>
</div>
<div class="twitter large-3 medium-3 columns show-for-medium-up">
<?php { ?>
<p><span class="entypo-twitter"></span>
<a class="twitter-follow-button" data-show-count="false" href="http://twitter.com/<?php the_author_meta('twitter', $author->ID); ?>">
<?php echo $twitter; ?>
</a>
</p>
<?php } ?>
</div>
</div>
</div>
<!--end bio-row-->
</div>
<div class="row contact-info-wrapper show-for-small-only">
<div class="email small-6 columns">
<?php if ($email) { ?>
<p><span class="entypo-mail"></span>
<a class="author-email-inside" href="mailto:<?php echo "$author->user_email"; ?>">
<?php echo "$author->user_email"; ?>
</a></p>
<?php } ?>
</div>
<div class="twitter small-3 columns">
<?php if ($twitter) { ?>
<p><span class="entypo-twitter"></span>
<a class="twitter-follow-button" data-show-count="false" href="http://twitter.com/<?php the_author_meta('twitter', $author->ID); ?>">
<?php echo get_the_author_meta('twitter_handle', $author->ID); ?>
</a>
</p>
<?php } ?>
</div>
</div>
<?php } } } ?>
<!-- </p> -->
</div><!-- end div.post-content -->
</div><!-- end div.entry-content -->
<hr>
<p id="comment-policy">Comments are supposed to create a forum for thoughtful, respectful community discussion. Please be nice. <a href="<?php echo get_permalink(get_page_by_path('comment-policy')); ?>">View our full comments policy here.</a></p>
<?php comments_template(); ?>
</article>
<?php endwhile; /* End loop */ ?>