-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsingle.php
137 lines (114 loc) · 3.62 KB
/
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
<?php
global $post;
$related_posts = get_posts([
'post_type' => 'post',
'posts_per_page' => '3',
'post__not_in' => [ $post->ID ],
'orderby' => 'rand',
// 'category__in' => array_map(function($term) {
// return $term->term_id;
// }, get_the_category()),
]);
///// ?>
<?php the_post(); ?>
<?php get_header(); ?>
<main role="main">
<header
class="post-hero / wp-block-cover alignfull"
style="min-height:250px;"
>
<span
aria-hidden="true"
class="has-color-1-light-background-color wp-block-cover__gradient-background"
></span>
<div class="wp-block-cover__inner-container">
<section class="wp-block-columns alignwide">
<div class="wp-block-column">
<h1 class="has-color has-text-color">
<?php the_title(); ?>
</h1>
<div class="post-meta / alignwide">
<span class="meta-categories">
<?php foreach (get_the_category() as $term): ?>
<a href="<?= get_category_link($term) ?>">
<?= $term->name ?>
</a>
<?php endforeach; ?>
</span>
<span class="meta-author">
By <?php the_author(); ?>
</span>
<time class="meta-date">
<i></i>
<?= get_the_date() ?>
</time>
<?php if (get_comments_number() !== '0'): ?>
<span class="meta-comments">
<i></i>
<a href="#comments">
<?= sprintf(__('%d Comments'), get_comments_number()) ?>
</a>
</span>
<?php endif; ?>
<?php if (has_tag()): ?>
<span class="meta-tags">
<i></i>
<?php foreach (get_the_tags() as $tag): ?>
<a href="<?= get_tag_link($tag) ?>">
<?= $tag->name ?>
</a>
<?php endforeach; ?>
</span>
<?php endif; ?>
</div>
</div>
<?php if (has_post_thumbnail()): ?>
<div class="wp-block-column" style="flex-basis:35%">
<picture class="featured-image | wp-block-image">
<source
srcset="<?= get_the_post_thumbnail_url(null, 'medium'); ?>"
media="(max-width: 480px)"
>
<?php the_post_thumbnail('large'); ?>
</picture>
<div class="wp-block-spacer is-style-h-negative" style="margin-bottom:-50px"></div>
</div>
<?php endif; ?>
</section>
</div>
</header>
<div class="post-columns / wp-block-columns alignwide">
<article class="wp-block-column" style="flex-basis:66.66%">
<?php the_content(); ?>
<?php if (function_exists('sharing_display')) {
do_shortcode('[h-jetpack-sharing]');
} ?>
<?php get_template_part('parts/author', ''); ?>
<nav class="post-nav">
<?php previous_post_link('%link', '%thumbnail <p>%label %title</p>'); ?>
<?php next_post_link('%link', '%thumbnail <p>%label %title</p>'); ?>
</nav>
</article>
<?php if (is_active_sidebar('sidebar')): ?>
<aside class="sidebar / wp-block-column" style="flex-basis:33.33%">
<div class="sidebar-inner">
<?php dynamic_sidebar('sidebar'); ?>
</div>
</aside>
<?php endif; ?>
</div>
<footer class="related-posts / wp-block-group has-background has-text-invert-background-color alignfull">
<div class="wp-block-group__inner-container">
<h3 class="alignwide">
<?= __('Related Posts') ?>
</h3>
<?php get_template_part('parts/posts', '', $related_posts); ?>
</div>
</footer>
</main>
<?php
if (comments_open() || get_comments_number()) {
comments_template();
}
?>
<?php get_footer(); ?>