-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle.php
More file actions
441 lines (292 loc) · 13.8 KB
/
single.php
File metadata and controls
441 lines (292 loc) · 13.8 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
<?php
get_header();
$format = get_post_format();
?>
<div class="wrapper">
<div class="wrapper-inner section-inner thin">
<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ($format == 'video') : ?>
<div class="featured-media">
<?php
// Fetch post content
$content = get_post_field( 'post_content', get_the_ID() );
// Get content parts
$content_parts = get_extended( $content );
// oEmbed part before <!--more--> tag
$embed_code = wp_oembed_get($content_parts['main']);
echo $embed_code;
?>
</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 ( has_post_thumbnail() ) : ?>
<div class="featured-media">
<?php the_post_thumbnail('post-image'); ?>
<?php if ( !empty(get_post(get_post_thumbnail_id())->post_excerpt) ) : ?>
<div class="media-caption-container">
<p class="media-caption"><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></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>
<h1 class="post-title"><?php the_title(); ?></h1>
</div> <!-- /post-header -->
<div class="post-content">
<?php
if ($format == 'link' || $format == 'quote' || $format == 'video') {
$content = $content_parts['extended'];
$content = apply_filters('the_content', $content);
echo $content;
} else {
the_content();
}
wp_link_pages();
the_field('texto');
?>
<div class="clear"></div>
</div> <!-- /post-content -->
<?php
$args = array(
'before' => '<div class="clear"></div><p class="page-links"><span class="title">' . __( 'Pages:','garfunkel' ) . '</span>',
'after' => '</p>',
'link_before' => '<span>',
'link_after' => '</span>',
'separator' => '',
'pagelink' => '%',
'echo' => 1
);
wp_link_pages($args);
?>
</div> <!-- /post-inner -->
<div class="post-meta bottom">
<div class="tab-selector">
<ul>
<li>
<a class="active tab-comments-toggle" href="#">
<div class="genericon genericon-comment"></div>
<span><?php _e('Comments','garfunkel'); ?></span>
</a>
</li>
<li>
<a class="tab-post-meta-toggle" href="#">
<div class="genericon genericon-summary"></div>
<span><?php _e('Post info','garfunkel'); ?></span>
</a>
</li>
<li>
<a class="tab-author-meta-toggle" href="#">
<div class="genericon genericon-user"></div>
<span><?php _e('Author info','garfunkel'); ?></span>
</a>
</li>
<div class="clear"></div>
</ul>
</div>
<div class="post-meta-tabs">
<div class="post-meta-tabs-inner">
<div class="tab-post-meta tab">
<ul class="post-info-items fright">
<li>
<div class="genericon genericon-user"></div>
<?php the_author_posts_link(); ?>
</li>
<li>
<div class="genericon genericon-time"></div>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_date( get_option('date-format') ); ?>
</a>
</li>
<li>
<div class="genericon genericon-category"></div>
<?php the_category(', '); ?>
</li>
<?php if ( has_tag() ) : ?>
<li>
<div class="genericon genericon-tag"></div>
<?php the_tags('', ', '); ?>
</li>
<?php endif; ?>
</ul>
<div class="post-nav fleft">
<?php
$prev_post = get_previous_post();
if (!empty( $prev_post )): ?>
<a class="post-nav-prev" title="<?php _e('Previous post:', 'garfunkel'); echo ' ' . esc_attr( get_the_title($prev_post) ); ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>">
<p><?php _e('Previous post', 'garfunkel'); ?></p>
<h4><?php echo get_the_title($prev_post); ?></h4>
</a>
<?php endif; ?>
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a class="post-nav-next" title="<?php _e('Next post:', 'garfunkel'); echo ' ' . esc_attr( get_the_title($next_post) ); ?>" href="<?php echo get_permalink( $next_post->ID ); ?>">
<p><?php _e('Next post', 'garfunkel'); ?></p>
<h4><?php echo get_the_title($next_post); ?></h4>
</a>
<?php endif; ?>
</div>
<div class="clear"></div>
</div> <!-- /tab-post-meta -->
<div class="tab-author-meta tab">
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" class="author-avatar"><?php echo get_avatar( get_the_author_meta( 'email' ), '256' ); ?></a>
<div class="author-meta-inner">
<h3 class="author-name"><?php the_author_posts_link(); ?></h3>
<p class="author-position">
<?php
global $post;
if ( user_can( $post->post_author, 'administrator' ) ) {
_e('Administrator','garfunkel');
} elseif ( user_can( $post->post_author, 'editor' ) ) {
_e('Editor','garfunkel');
} elseif ( user_can( $post->post_author, 'author' ) ) {
_e('Author','garfunkel');
} elseif ( user_can( $post->post_author, 'contributor' ) ) {
_e('Contributor','garfunkel');
} elseif ( user_can( $post->post_author, 'subscriber' ) ) {
_e('Subscriber','garfunkel');
} else {
_e('Guest','garfunkel');
}
?>
</p>
<?php $author_meta_description = get_the_author_meta('description'); ?>
<?php if ( ! empty( $author_meta_description ) ) : ?>
<p class="author-description">
<?php the_author_meta('description'); ?>
</p>
<?php endif; ?>
</div> <!-- /author-meta-inner -->
<div class="author-content">
<div class="one-half author-posts">
<h4 class="content-by"><?php _e('Posts by','garfunkel'); ?> <?php the_author_meta('display_name'); ?></h4>
<ul>
<?php
$args = array(
'posts_per_page' => 5,
'post__not_in'=> array($post->ID),
'author' => get_the_author_meta('id'),
);
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<li <?php if ( has_post_thumbnail() ) { echo 'class="has-thumb"'; } ?>>
<a href="<?php the_permalink(); ?>">
<div class="post-icon">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('thumbnail');
} else {
$post_format = get_post_format();
if ( empty($post_format) ) { $post_format = 'standard'; }
echo '<div class="genericon genericon-' . $post_format . '"></div>';
}
?>
</div>
<h5 class="title"><?php the_title(); ?></h5>
<p class="meta"><?php the_time(get_option('date_format')); ?></p>
<div class="clear"></div>
</a>
</li>
<?php endforeach;
wp_reset_postdata();?>
</ul>
</div> <!-- /author-posts -->
<div class="one-half author-comments">
<h4 class="content-by"><?php _e('Comments by','garfunkel'); ?> <?php the_author_meta('display_name'); ?></h4>
<ul>
<?php
$comments = get_comments('user_id=' . get_the_author_meta('id') . '&number=5');
foreach($comments as $comment) : ?>
<?php
$comment_excerpt = ($comment->comment_content);
if (strlen($comment_excerpt) > 60) {
$comment_excerpt = substr($comment_excerpt, 0, 60);
$comment_excerpt = substr($comment_excerpt,0,strrpos($comment_excerpt," "));
$etc = " ...";
$comment_excerpt = $comment_excerpt.$etc;
}
?>
<li>
<a href="<?php echo get_permalink($comment->ID); ?>#comment-<?php echo $comment->comment_ID; ?>" title='<?php _e('Posted on','garfunkel'); ?> <?php comment_date(get_option('date_format'), $comment->comment_ID); ?> <?php _e('to','garfunkel'); ?> <?php echo get_the_title($comment->comment_post_ID); ?>'>
<div class="post-icon">
<?php if ( '' != get_the_post_thumbnail($comment->comment_post_ID) ) : ?>
<?php echo get_the_post_thumbnail($comment->comment_post_ID, 'thumbnail'); ?>
<?php else : ?>
<div class="genericon genericon-comment"></div>
<?php endif; ?>
</div>
<h5 class="title"><?php echo get_the_title($comment->comment_post_ID); ?></h5>
<p class="excerpt"><?php echo $comment_excerpt; ?></p>
</a>
</li>
<?php endforeach;
wp_reset_postdata();
?>
</ul>
</div> <!-- /author-comments -->
<div class="clear"></div>
</div> <!-- /author-content -->
</div> <!-- /tab-author-meta -->
<div class="tab-comments tab">
<?php comments_template( '', true ); ?>
</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 _e('Previous post', 'garfunkel'); echo ': ' . esc_attr( get_the_title($prev_post) ); ?>" href="<?php echo get_permalink( $prev_post->ID ); ?>">
<span class="hidden"><?php _e('Previous post', 'garfunkel'); ?></span>
<span class="arrow">«</span>
</a>
<?php endif; ?>
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
<a class="post-nav-next" title="<?php _e('Next post', 'garfunkel'); echo ': ' . esc_attr( get_the_title($next_post) ); ?>" href="<?php echo get_permalink( $next_post->ID ); ?>">
<span class="hidden"><?php _e('Next post', 'garfunkel'); ?></span>
<span class="arrow">»</span>
</a>
<?php endif; ?>
<div class="clear"></div>
</div> <!-- /post-nav -->
<?php endwhile; else: ?>
<p><?php _e("We couldn't find any posts that matched your query. Please try again.", "garfunkel"); ?></p>
<?php endif; ?>
<?php get_sidebar(); ?>
</div> <!-- /post -->
</div> <!-- /content -->
<div class="clear"></div>
</div> <!-- /wrapper-inner -->
</div> <!-- /wrapper -->
<?php get_footer(); ?>