-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
167 lines (142 loc) · 7.33 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
<?php
/**
* The Template for displaying all single posts.
*
* @package Bucket Lite
* @since Bucket Lite 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
get_header(); ?>
<div class="container container--main">
<div class="grid">
<?php
// let's get to know this post a little better
$full_width_featured_image = get_post_meta( wpgrade::lang_post_id( get_the_ID() ), '_bucket_full_width_featured_image', true );
$disable_sidebar = get_post_meta( wpgrade::lang_post_id( get_the_ID() ), '_bucket_disable_sidebar', true );
// let's use what we know
$the_content_width = $disable_sidebar == 'on' ? 'one-whole' : 'lap-and-up-two-thirds';
$featured_image_width = $full_width_featured_image == 'on' || $disable_sidebar == 'on' ? 'one-whole' : 'lap-and-up-two-thirds';
get_template_part( 'theme-partials/post-templates/header-single', get_post_format() ); ?>
<article
class="post-article js-post-gallery grid__item main float--left <?php echo $the_content_width; ?>">
<?php while ( have_posts() ) {
the_post();
get_template_part( 'theme-partials/post-templates/single-title' ); ?>
<?php
the_content();
$args = array(
'before' => "<ol class=\"nav pagination\"><!--",
'after' => "\n--></ol>",
'next_or_number' => 'next_and_number',
'previouspagelink' => esc_html__( 'Previous', 'bucket-lite' ),
'nextpagelink' => esc_html__( 'Next', 'bucket-lite' )
);
wp_link_pages( $args ); ?>
<div class="article__meta article--single__meta">
<?php
$categories = get_the_category();
if ( $categories ) { ?>
<div class="btn-list">
<div class="btn btn--small btn--secondary"><?php esc_html_e( 'Categories', 'bucket-lite' ) ?></div>
<?php
foreach ( $categories as $category ) {
/* translators: %s: Category name */
echo '<a class="btn btn--small btn--tertiary" href="' . esc_url( get_category_link( $category->term_id ) ) . '" title="' . sprintf( esc_attr__( 'View all posts in %s', 'bucket-lite' ), esc_html( $category->name ) ) . '">' . esc_html( $category->name ) . '</a>';
} ?>
</div>
<?php }
$tags = get_the_tags();
if ( $tags ) { ?>
<div class="btn-list">
<div class="btn btn--small btn--secondary"><?php esc_html_e( 'Tagged', 'bucket-lite' ) ?></div>
<?php
foreach ( $tags as $one_tag ) {
/* translators: %s: Tag name */
echo '<a class="btn btn--small btn--tertiary" href="' . esc_url( get_tag_link( $one_tag->term_id ) ) . '" title="' . sprintf( esc_attr__( 'View all posts tagged %s', 'bucket-lite' ), esc_html( $one_tag->name ) ) . '">' . esc_html( $one_tag->name ) . '</a>';
} ?>
</div>
<?php } ?>
</div>
<?php
get_template_part( 'author-bio' );
$next_post = get_next_post();
$prev_post = get_previous_post();
if ( ! empty( $prev_post ) || ! empty( $next_post ) ) { ?>
<nav class="post-nav grid"><!--
<?php if ( ! empty( $prev_post ) && ! empty( $next_post ) ){ ?>
--><div class="post-nav-link post-nav-link--prev grid__item one-whole lap-and-up-one-half">
<a href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>">
<span class="post-nav-link__label">
<?php esc_html_e( 'Previous Article', 'bucket-lite' ); ?>
</span>
<span class="post-nav-link__title">
<h3 class="hN"><?php echo esc_html( $prev_post->post_title ); ?></h3>
</span>
</a>
</div><!--
<?php } elseif ( empty( $next_post ) && ! empty( $prev_post ) ){ ?>
--><div class="post-nav-link post-nav-link--prev grid__item one-whole lap-and-up-one-half">
<a href="<?php echo esc_url( get_permalink( $prev_post->ID ) ); ?>">
<span class="post-nav-link__label">
<?php esc_html_e( 'Previous Article', 'bucket-lite' ); ?>
</span>
<span class="post-nav-link__title">
<h3 class="hN"><?php echo esc_html( $prev_post->post_title ); ?></h3>
</span>
</a>
</div><!--
--><div class="post-nav-link post-nav-link--blank grid__item one-whole lap-and-up-one-half">
</div><!--
<?php }
if ( ! empty( $prev_post ) && ! empty( $next_post ) ){ ?>
--><div class="divider--pointer"></div><!--
<?php }
if ( ! empty( $next_post ) && ! empty( $prev_post ) ){ ?>
--><div class="post-nav-link post-nav-link--next grid__item one-whole lap-and-up-one-half">
<a href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>">
<span class="post-nav-link__label">
<?php esc_html_e( 'Next Article', 'bucket-lite' ); ?>
</span>
<span class="post-nav-link__title">
<h3 class="hN"><?php echo esc_html( $next_post->post_title ); ?></h3>
</span>
</a>
</div><!--
<?php } elseif ( ! empty( $next_post ) && empty( $prev_post ) ){ ?>
--><div class="post-nav-link post-nav-link--blank grid__item one-whole lap-and-up-one-half">
</div><!--
--><div class="post-nav-link post-nav-link--next grid__item one-whole lap-and-up-one-half">
<a href="<?php echo esc_url( get_permalink( $next_post->ID ) ); ?>">
<span class="post-nav-link__label">
<?php esc_html_e( 'Next Article', 'bucket-lite' ); ?>
</span>
<span class="post-nav-link__title">
<h3 class="hN"><?php echo esc_html( $next_post->post_title ); ?></h3>
</span>
</a>
</div><!--
<?php } ?>
--></nav>
<?php } ?>
<hr class="separator separator--section">
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) {
comments_template();
}
} ?>
</article><!--
<?php if ( $disable_sidebar != 'on' ){ ?>
--><div class="grid__item one-third palm-one-whole sidebar">
<?php get_sidebar();
} else { // ugly ?>
-->
<?php } ?>
</div>
</div>
</div>
<?php get_footer();