-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
236 lines (191 loc) · 8.27 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
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
<?php
get_header();
?>
<!-- Content
============================================= -->
<section id="content">
<div class="content-wrap">
<div class="container clearfix">
<!-- Post Content
============================================= -->
<div class="postcontent nobottommargin clearfix">
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
global $post;
$author_id = $post->post_author;
?>
<div id="post-<?php the_ID(); ?>" <?php post_class('single-post nobottommargin'); ?>>
<!-- Single Post
============================================= -->
<div class="entry clearfix">
<!-- Entry Title
============================================= -->
<div class="entry-title">
<h2>
<?php the_title(); ?>
</h2>
</div><!-- .entry-title end -->
<!-- Entry Meta
============================================= -->
<ul class="entry-meta clearfix">
<li><i class="icon-calendar3"></i>
<?php the_date(); ?>
</li>
<li>
<a href="<?php echo get_author_posts_url( $author_id ); ?>">
<i class="icon-user"></i>
<?php the_author(); ?>
</a>
</li>
<li><i class="icon-folder-open"></i>
<?php the_category( ', ' ); ?>
</li>
<li><a href="#"><i class="icon-comments"></i>
<?php comments_number( '0' ); ?>
</a></li>
</ul><!-- .entry-meta end -->
<!-- Entry Image
============================================= -->
<div class="entry-image">
<a href="<?php the_permalink(); ?>">
<?php
the_post_thumbnail(
'full'
);
?>
</a>
</div><!-- .entry-image end -->
<!-- Entry Content
============================================= -->
<div class="entry-content notopmargin">
<?php the_content(); ?>
<?php wp_link_pages(
array(
'before' => '<div class="page-links text-center">' . __( 'Pages:', 'bodjack' ),
'after' => '</div>',
)
); ?>
<!-- Post Single - Content End -->
<!-- Tag Cloud
============================================= -->
<div class="tagcloud clearfix bottommargin">
<?php the_tags( '', ' ' ); ?>
</div><!-- .tagcloud end -->
<div class="clear"></div>
</div>
</div><!-- .entry end -->
<!-- Post Navigation
============================================= -->
<div class="post-navigation clearfix">
<div class="col_half nobottommargin">
<?php previous_post_link( '%link', '⇐ %title' ); ?>
</div>
<div class="col_half col_last tright nobottommargin">
<?php next_post_link( '%link', '%title ⇒' ); ?>
</div>
</div><!-- .post-navigation end -->
<div class="line"></div>
<!-- Post Author Info
============================================= -->
<div class="card">
<div class="card-header">
<strong>
Posted by
<a href="<?php echo get_author_posts_url( $author_id ); ?>">
<?php the_author(); ?>
</a>
</strong>
</div>
<div class="card-body">
<div class="author-image">
<?php echo get_avatar( $author_id, '90', '', false, array(
'class' => 'img-circle'
) ); ?>
</div>
<?php echo nl2br(get_the_author_meta( 'description' )); ?>
</div>
</div><!-- Post Single - Author End -->
<div class="line"></div>
<h4>
<?php _e('Related Posts:', 'bodjack'); ?>
</h4>
<div class="related-posts clearfix">
<?php
$categories = get_the_category();
$rp_query = new WP_Query(
array(
'posts_per_page' => 2,
'post__not_in' => array( $post->ID ),
'category__in' => wp_get_post_categories( $post->ID ),
'orderby' => 'rand',
)
);
if ( $rp_query->have_posts() ) :
while ( $rp_query->have_posts() ) :
$rp_query->the_post();
?>
<div class="mpost clearfix">
<?php
if ( has_post_thumbnail() ) {
?>
<div class="entry-image">
<a href="<?php echo get_the_permalink(); ?>">
<?php the_post_thumbnail( 'thumbnail' );?>
</a>
</div>
<?php
}
?>
<div class="entry-c">
<div class="entry-title">
<h4>
<a href="<?php echo get_the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h4>
</div>
<ul class="entry-meta clearfix">
<li><i class="icon-calendar3"></i>
<?php the_date(); ?>
</li>
<li><i class="icon-comments"></i>
<?php comments_number( '0' ); ?>
</li>
</ul>
<div class="entry-content">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php
endwhile;
// reset post data
wp_reset_postdata();
endif;
?>
</div>
<!-- Comments
============================================= -->
<?php
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<!-- #comments end -->
</div>
</div><!-- .postcontent end -->
<?php
endwhile;
endif;
?>
<!-- Sidebar
============================================= -->
<?php get_sidebar(); ?>
<!-- .sidebar end -->
</div>
</div>
</div>
</section><!-- #content end -->
<?php get_footer(); ?>