Repository navigation
Expand file tree
/
Copy pathsingle.php
More file actions
244 lines (212 loc) · 5.76 KB
/
Copy pathsingle.php
File metadata and controls
244 lines (212 loc) · 5.76 KB
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
237
238
239
240
241
242
243
244
<?php
/*
* The template for displaying single posts and pages.
*/
get_header();
?>
<div class="wrapper" id="main">
<?php
while (have_posts()) : the_post();
$date_format = get_option('date_format');
$date = (string)get_the_date($date_format);
$cat = get_the_category();
$author_id = (int)get_the_author_meta('ID');
$custom_header_image = get_field('custom_header_image');
?>
<section class="single-hero-section <?php if ($custom_header_image) {
echo 'custom_header_image';
} ?>" style="<?php if ($custom_header_image) {
echo 'background: url(' . $custom_header_image . ');';
} ?>">
<div class="container">
<div class="row">
<div class="col-12">
<div class="section-title">
<?php
echo '<h1>' . get_the_title() . '</h1>';
?>
</div>
</div>
</div>
<div class="row post_meta">
<div class="col-lg-4 post_date">
<div class="date-block">
<span class="date_label">
<?php echo __('Post date', 'nextcloud'); ?>
</span>
<?php
echo '<p>' . $date . '</p>';
?>
</div>
</div>
<div class="col-lg-4 post_cats">
<div class="cat-block">
<span class="cat_label">
<?php echo __('Categories', 'nextcloud'); ?>
</span>
<?php
echo '<ul>';
foreach ($cat as $c) {
if ($c->term_id != 243 && $c->term_id != 241 && $c->term_id != 60 && $c->term_id != 1) { // exclude Uncategorized, sin categoria and Sin categorizar
$category_link = get_category_link($c->term_id);
echo '<li><a href="' . $category_link . '">' . $c->name . '</a></li>';
}
}
echo '</ul>';
?>
</div>
</div>
<div class="col-lg-4 post_author">
<div class="author-block">
<span class="author_label">
<?php echo __('Author', 'nextcloud'); ?>
</span>
<?php
echo '<p>' . get_the_author_meta('display_name', $author_id) . '</p>';
?>
</div>
</div>
<div class="col-12">
<?php get_template_part('inc/share-block'); ?>
</div>
</div>
</div>
</section>
<section class="post-single-section">
<div class="container post_single_container">
<div class="row justify-content-center">
<div class="col-lg-8 col-md-12">
<div class="text-block">
<?php
//add custom pattern block on all blog posts to promote release blog post
$current_post_id = get_the_ID();
//exception for Hub 26 Spring post, all languages
$excluded_posts = [
429294, 434039, 434067, 434042, 434061
];
/*
if ( ! in_array((int) $current_post_id, $excluded_posts, true) ) {
//show Hub 26 Spring promo block on all posts
$pattern_id = 425767; // pattern ID
$pattern_post = get_post( $pattern_id );
if ( $pattern_post && $pattern_post->post_type === 'wp_block' ) {
echo apply_filters( 'the_content', $pattern_post->post_content );
}
}
*/
/*
* IMPORTANT:
* Process the actual post content FIRST.
* Don't echo it yet.
*/
$post_content = apply_filters(
'the_content',
get_the_content()
);
/*
* Promo pattern
*/
$pattern_content = '';
if (! in_array((int)$current_post_id, $excluded_posts, true)) {
$pattern_id = 435567;
$pattern_post = get_post($pattern_id);
if ($pattern_post instanceof WP_Post && $pattern_post->post_type === 'wp_block') {
$pattern_content = apply_filters(
'the_content',
$pattern_post->post_content
);
}
}
/*
* OUTPUT ORDER:
*
* 1. Pattern
* 2. Blog content
*/
echo $pattern_content;
echo $post_content;
//echo do_shortcode(apply_filters('the_content', get_the_content()));
endwhile; // End of the loop.
?>
</div>
</div>
</div>
</div>
</section>
<section class="related-posts-section">
<div class="container">
<div class="row">
<div class="col-12">
<div class="section-title">
<h3><?php echo __('Other posts', 'nextcloud'); ?></h3>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="related-slider owl-carousel">
<?php get_template_part('inc/related_posts'); ?>
</div>
</div>
</div>
</div>
</section>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if (comments_open() && get_comments_number()) :
?>
<section class="comments-section" data-comments-number="<?php echo get_comments_number(); ?>">
<div class="container">
<div class="row justify-content-center">
<div class="col-10">
<div class="section-title text-center">
<h3><?php echo __('Comments', 'nextcloud'); ?></h3>
</div>
<div class="single_post_comments">
<?php
comments_template();
?>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php
/*
$forum = get_field('footer_text', 'options');
$link = get_field('footer_link', 'options');
$discourse_link = get_field('discourse_permalink');
if ($discourse_link != '') {
$forum = __('Continue the discussion at the Nextcloud forums','nextcloud');
}
if (!empty($forum)) {
?>
<section class="get-started-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="text-block">
<?php
echo '<h3>' . $forum . '</h3>';
if ($discourse_link != '') {
echo '<a class="c-btn btn-white" href="' . esc_url($discourse_link) . '" target="_blank">'.__('Go to Forums','nextcloud').'</a>';
} else if ($link) {
$link_url = $link['url'];
$link_title = $link['title'];
$link_target = $link['target'] ? $link['target'] : '_self';
echo '<a class="c-btn btn-white" href="' . esc_url($link_url) . '" target="' . esc_attr($link_target) . '">' . esc_html($link_title) . '</a>';
}
?>
</div>
</div>
</div>
</div>
</section>
<?php
}
*/
?>
</div>
<?php
get_footer();