-
Notifications
You must be signed in to change notification settings - Fork 54
/
single.php
executable file
·59 lines (51 loc) · 1.48 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
<?php
/**
* The Template for displaying all single posts.
*/
get_header();
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
get_template_part( 'content', 'single' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
endwhile;
endif;
wp_reset_postdata();
$count_posts = wp_count_posts();
if ( $count_posts->publish > '1' ) :
$next_post = get_next_post();
$prev_post = get_previous_post();
?>
<hr class="mt-5">
<div class="post-navigation d-flex justify-content-between">
<?php
if ( $prev_post ) {
$prev_title = get_the_title( $prev_post->ID );
?>
<div class="pr-3">
<a class="previous-post btn btn-lg btn-outline-secondary" href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>" title="<?php echo esc_attr( $prev_title ); ?>">
<span class="arrow">←</span>
<span class="title"><?php echo wp_kses_post( $prev_title ); ?></span>
</a>
</div>
<?php
}
if ( $next_post ) {
$next_title = get_the_title( $next_post->ID );
?>
<div class="pl-3">
<a class="next-post btn btn-lg btn-outline-secondary" href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>" title="<?php echo esc_attr( $next_title ); ?>">
<span class="title"><?php echo wp_kses_post( $next_title ); ?></span>
<span class="arrow">→</span>
</a>
</div>
<?php
}
?>
</div><!-- /.post-navigation -->
<?php
endif;
get_footer();