-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
94 lines (51 loc) · 2.19 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
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package WordPress
* @subpackage ServicesUOL
* @author Jez Thompson <[email protected]>
* @since 1.0
* @version 1.0
*/
get_header(); ?>
<?php get_template_part( 'template-parts/featured-image' ); ?>
<main id="main" class="site-main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="content-container">
<?php get_template_part( 'template-parts/content', get_post_type() ); ?>
<?php
//Is there a next or previous post?
$prev_link = get_previous_post_link();
$next_link = get_next_post_link();
//Get the next or previous link url
$previous = get_previous_post();
$next = get_next_post();
?>
<?php if ($prev_link || $next_link): ?>
<ul class="single-pagination">
<li class="single-pagination__link">
<?php if ($prev_link) : ?>
<a class="main-btn block-button dark" href="<?php echo $previous->guid ?>"><i class="far fa-angle-left"></i> Previous Post</a>
<?php endif; ?>
</li>
<li class="single-pagination__link">
<?php if ($next_link) : ?>
<a class="main-btn block-button dark" href="<?php echo $next->guid ?>">Next Post <i class="far fa-angle-right"></i></a>
<?php endif; ?>
</li>
</ul><!-- single-pagination -->
<?php endif; ?>
<?php if ( comments_open() || get_comments_number() ) : ?>
<div class="comments-container">
<?php comments_template(); ?>
</div> <!-- comments-container -->
</div>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
</main><!-- #main -->
<?php get_footer(); ?>