-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsingle.php
More file actions
454 lines (282 loc) · 12.2 KB
/
single.php
File metadata and controls
454 lines (282 loc) · 12.2 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
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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<?php get_header(); ?>
<div class="wrapper">
<?php $wrapper_width = ! is_page_template( 'template-fullwidth.php' ) ? ' thin' : ''; ?>
<div class="wrapper-inner section-inner group<?php echo esc_attr( $wrapper_width ); ?>">
<div class="content">
<?php if ( have_posts() ) : while( have_posts() ) : the_post();
$format = get_post_format();
// get author name, for sites that create nomral posts, we can use WP author link
// Here ya go GCC CTLE
$wAuthor = ( get_post_meta( $post->ID, 'shared_by', 1 ) ) ? get_post_meta( $post->ID, 'shared_by', 1 ) : get_the_author_posts_link();
$wCredit = get_post_meta( $post->ID, 'credit', 1 );
$wLicense = get_post_meta( $post->ID, 'license', 1 );
$media_url = get_post_meta($post->ID, 'media_url', 1);
$wAlt = get_post_meta($post->ID, 'image_alt', 1);
$wMediaType = url_is_media_type($media_url);
$attributions = ['',''];
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'post' ); ?>>
<?php if ( $format == 'video' ) : ?>
<div class="featured-media">
<?php
// can we embed this url?
if ( is_url_embeddable( $media_url ) ) {
echo '<!-- embeddabble -->';
// Use oEmbed for YouTube, et al
$embed_code = wp_oembed_get( $media_url );
echo $embed_code;
} else {
// then we have a video file so show it as a player
echo '<!-- not embeddabble -->';
echo splotbox_get_videoplayer( $media_url );
}
?>
</div><!-- .featured-media -->
<?php elseif ( $format == 'audio' ) : ?>
<div class="featured-media">
<?php
// can we embed this audio url?
if ( is_url_embeddable( $media_url ) ) {
// then do it
// oEmbed part before <!--more--> tag
$embed_code = wp_oembed_get( $media_url );
echo $embed_code;
} else {
// then we have a sound file so show it as a player
echo splotbox_get_audioplayer( $media_url );
}
?>
</div><!-- .featured-media -->
<?php elseif ( $format == 'quote' ) : ?>
<div class="post-quote">
<?php
// Fetch post content
$content = get_post_field( 'post_content', get_the_ID() );
// Get content parts
$content_parts = get_extended( $content );
// Output part before <!--more--> tag
echo $content_parts['main'];
?>
</div><!-- .post-quote -->
<?php elseif ( $format == 'link' ) : ?>
<div class="post-link">
<?php
// Fetch post content
$content = get_post_field( 'post_content', get_the_ID() );
// Get content parts
$content_parts = get_extended( $content );
// Output part before <!--more--> tag
echo $content_parts['main'];
?>
</div><!-- .post-link -->
<?php elseif ( $format == 'gallery' ) : ?>
<div class="featured-media">
<?php garfunkel_flexslider( 'post-image' ); ?>
</div><!-- .featured-media -->
<?php elseif ( $wMediaType == 'image' ) : ?>
<div class="featured-media">
<?php
// can we embed this image url?
if ( is_url_embeddable( $media_url ) ) {
// then do it
// oEmbed part before <!--more--> tag
$embed_code = wp_oembed_get( $media_url );
echo $embed_code;
echo '<div class="media-caption-container">
<p class="media-caption">' . $media_url . ' </p>
</div>';
} else {
// then we have an image file so get it's code
echo splotbox_get_imageplayer( $media_url, $wAlt );
}
?>
</div>
<?php elseif ( has_post_thumbnail() ) : ?>
<div class="featured-media">
<?php
the_post_thumbnail( 'post-image' );
$image_caption = get_post( get_post_thumbnail_id() )->post_excerpt;
if ( $image_caption ) : ?>
<div class="media-caption-container">
<p class="media-caption"><?php echo $image_caption; ?></p>
</div>
<?php endif; ?>
</div><!-- .featured-media -->
<?php endif; ?>
<div class="post-inner">
<div class="post-header">
<p class="post-date"><?php the_time( get_option( 'date_format' ) ); ?><?php edit_post_link( __( 'Edit','garfunkel' ), '<span class="sep">/</span>' ); ?></p>
<?php the_title( '<h1 class="post-title">', '</h1>' ); ?>
</div><!-- .post-header -->
<div class="post-content entry-content">
<?php if ( is_preview() ):?>
<div class="notify"><span class="symbol icon-info"></span>
This is a preview of your entry that shows how it will look when published. <a href="#" onclick="self.close();return false;">Close this window/tab</a> when done to return to the submission form. Make any changes and check the info again or if it is ready, click <strong>Submit Item</strong>
</div>
<?php endif?>
<?php
// if stuff has a more tag..
if ( $pos = strpos( $post->post_content, '<!--more-->' ) ) {
// Fetch post content
$content = get_post_field( 'post_content', get_the_ID() );
$content_parts = get_extended( $content );
$content_show = apply_filters( 'the_content', $content_parts['extended']);
echo $content_show;
} else {
the_content();
}
?>
<?php
if ( url_is_audio_link ( $media_url ) ) echo '<p><a href="' . $media_url . '" class="download-link pretty-button pretty-button-gray" download>Download "' . get_the_title() . '"</a></p>';
?>
<div class="sb_meta">
<?php
// alt descriptions y'all should be doing
if ($wAlt) {
echo '<p><strong>' . get_media_description_label() . ':</strong> ' . make_links_clickable($wAlt) . '</p>';
}
// Sharer
echo '<p><strong>' . get_credit_label() . ':</strong> ' . $wAuthor . '</p>';
if ( ( splotbox_option('use_source') > 0 ) AND $wCredit ) echo '<p><strong>' . get_attribution_label() . ':</strong> ' . make_links_clickable($wCredit) . '</p>';
if ( splotbox_option('use_license') > 0 AND $wLicense) {
echo '<p><strong>' . get_license_label() . ':</strong> ';
echo splotbox_the_license( $wLicense );
echo '</p>';
// display attribution?
if ( splotbox_option( 'show_attribution' ) == 1 ) {
$attributions = splotbox_attributor( $wLicense, get_the_title(), get_permalink(), $wCredit);?>
<h4>Copy/Paste Text Attribution</h4>
<textarea rows="2" onClick="this.select()" style="height:60px;"><?php echo $attributions[0]?></textarea>
<h4>Copy/Paste HTML Attribution</h4>
<textarea rows="3" onClick="this.select()" style="height:80px;"><?php echo $attributions[1]?></textarea>
<?php
}
}
?>
</div>
<?php if ( is_preview() ):?>
<div class="notify"><span class="symbol icon-info"></span> Once done reviewing your entry, <a href="#" onclick="self.close();return false;">Close this window/tab</a> to return to the editing form.
</div>
<?php endif?>
<div class="clear"></div>
</div><!-- .post-content -->
</div><!-- .post-inner -->
<div class="post-meta bottom">
<div class="tab-selector">
<ul class="group">
<li>
<a class="active tab-post-meta-toggle" href="#" data-target=".tab-post-meta">
<div class="genericon genericon-summary"></div>
<span><?php _e( 'Item info', 'garfunkel' ); ?></span>
</a>
</li>
<li>
<a class="tab-comments-toggle" href="#" data-target=".tab-comments">
<div class="genericon genericon-comment"></div>
<span><?php _e( 'Comments', 'garfunkel' ); ?></span>
</a>
</li>
</ul>
</div><!-- .tab-selector -->
<div class="post-meta-tabs">
<div class="post-meta-tabs-inner">
<div class="tab-post-meta tab group active">
<ul class="post-info-items fright">
<?php if ($wAuthor):?>
<li>
<div class="genericon genericon-user"></div>
<?php echo $wAuthor ?>
</li>
<?php endif?>
<li>
<div class="genericon genericon-time"></div>
<a href="<?php the_permalink(); ?>">
<?php the_time( get_option( 'date_format' ) ); ?>
</a>
</li>
<?php
if ( $wCredit ) echo '<li><div class="genericon genericon-info"></div> ' . make_links_clickable( $wCredit ) . '</li>';
?>
<?php if ($media_url):?>
<li>
<div class="genericon genericon-link"></div><a href="<?php echo $media_url; ?>" target="blank"><?php echo $media_url; ?></a>
</li>
<?php endif?>
<?php if (splotbox_option('use_license') > 0 AND $wLicense):?>
<li>
<div class="genericon genericon-flag"></div>
<?php echo splotbox_the_license( $wLicense ); ?>
</li>
<?php endif?>
<?php if ( splotbox_option('show_cats') ):?>
<li>
<div class="genericon genericon-category"></div>
<?php the_category(', '); ?>
</li>
<?php endif?>
<?php if ( has_tag() AND splotbox_option('show_tags') ) : ?>
<li>
<div class="genericon genericon-tag"></div>
<?php the_tags('', ', '); ?>
</li>
<?php endif; ?>
</ul>
<div class="post-nav fleft">
<?php if ( !is_preview() ):?>
<?php
$prev_post = get_previous_post();
if ( ! empty( $prev_post ) ) : ?>
<a class="post-nav-prev" title="<?php printf( __( 'Previous item: "%s"', 'garfunkel' ), esc_attr( get_the_title( $prev_post ) ) ); ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>">
<p><?php _e( 'Previous item', 'garfunkel' ); ?></p>
<h4><?php echo get_the_title( $prev_post ); ?></h4>
</a>
<?php endif;
$next_post = get_next_post();
if ( ! empty( $next_post ) ) : ?>
<a class="post-nav-next" title="<?php printf( __( 'Next item: "%s"', 'garfunkel' ), esc_attr( get_the_title( $next_post ) ) ); ?>" href="<?php echo get_permalink( $next_post->ID ); ?>">
<p><?php _e( 'Next item', 'garfunkel' ); ?></p>
<h4><?php echo get_the_title( $next_post ); ?></h4>
</a>
<?php endif; ?>
<?php endif; ?>
</div><!-- .post-nav -->
</div><!-- .tab-post-meta -->
<div class="tab-comments tab">
<?php
if ( splotbox_option('allow_comments') ) {
comments_template( '', true );
} else {
echo '<p>Sorry, but comments are not enabled on this site.</p>';
}
?>
</div><!-- .tab-comments -->
</div><!-- .post-meta-tabs-inner -->
</div><!-- .post-meta-tabs -->
</div><!-- .post-meta.bottom -->
<div class="post-nav-fixed">
<?php
$prev_post = get_previous_post();
if ( ! empty( $prev_post ) ) : ?>
<a class="post-nav-prev" title="<?php printf( __( 'Previous item: "%s"', 'garfunkel' ), the_title_attribute( array( 'post' => $prev_post->ID ) ) ); ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>">
<span class="hidden"><?php _e( 'Previous item', 'garfunkel' ); ?></span>
<span class="arrow">«</span>
</a>
<?php endif;
$next_post = get_next_post();
if ( ! empty( $next_post ) ) : ?>
<a class="post-nav-next" title="<?php printf( __( 'Next item: "%s"', 'garfunkel' ), the_title_attribute( array( 'post' => $next_post->ID ) ) ); ?>" href="<?php echo get_permalink( $next_post->ID ); ?>">
<span class="hidden"><?php _e( 'Next item', 'garfunkel' ); ?></span>
<span class="arrow">»</span>
</a>
<?php endif; ?>
</div><!-- .post-nav -->
<?php endwhile; else: ?>
<p><?php _e( "We couldn't find any items that matched your query. Please try again.", "garfunkel" ); ?></p>
<?php endif; ?>
<?php get_sidebar(); ?>
</article><!-- .post -->
</div><!-- .content -->
<div class="clear"></div>
</div><!-- .wrapper-inner -->
</div><!-- .wrapper -->
<?php get_footer(); ?>