Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/inc/components/single/content-helpers.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
if (! function_exists('blocksy_has_post_nav')) {
4
+
function blocksy_has_post_nav() {
5
+
$post_options = blocksy_get_post_options();
6
+
$prefix = blocksy_manager()->screen->get_prefix();
7
+
8
+
$has_post_nav = blocksy_get_theme_mod(
9
+
$prefix . '_has_post_nav',
10
+
'no'
11
+
) === 'yes';
12
+
13
+
if (blocksy_is_page()) {
14
+
$has_post_nav = false;
15
+
}
16
+
17
+
if (
18
+
blocksy_default_akg(
19
+
'disable_posts_navigation', $post_options, 'no'
20
+
) === 'yes'
21
+
) {
22
+
$has_post_nav = false;
23
+
}
24
+
25
+
return $has_post_nav;
26
+
}
27
+
}
28
+
29
+
if (! function_exists('blocksy_has_share_box')) {
30
+
function blocksy_has_share_box() {
31
+
$post_options = blocksy_get_post_options();
32
+
$prefix = blocksy_manager()->screen->get_prefix();
33
+
34
+
$has_share_box = blocksy_get_theme_mod(
35
+
$prefix . '_has_share_box',
36
+
'no'
37
+
) === 'yes';
38
+
39
+
if (
40
+
blocksy_default_akg(
41
+
'disable_share_box',
42
+
$post_options,
43
+
'no'
44
+
) === 'yes'
45
+
) {
46
+
$has_share_box = false;
47
+
}
48
+
49
+
return apply_filters(
50
+
'blocksy:single:has-share-box',
51
+
$has_share_box
52
+
);
53
+
}
54
+
}
55
+
56
+
if (! function_exists('blocksy_has_author_box')) {
57
+
function blocksy_has_author_box() {
58
+
$post_options = blocksy_get_post_options();
59
+
$prefix = blocksy_manager()->screen->get_prefix();
60
+
61
+
$has_author_box = blocksy_get_theme_mod(
62
+
$prefix . '_has_author_box',
63
+
'no'
64
+
) === 'yes';
65
+
66
+
if (blocksy_is_page()) {
67
+
$has_author_box = false;
68
+
}
69
+
70
+
if (
71
+
blocksy_default_akg(
72
+
'disable_author_box', $post_options, 'no'
73
+
) === 'yes'
74
+
) {
75
+
$has_author_box = false;
76
+
}
77
+
78
+
$has_author_box = apply_filters(
79
+
'blocksy:single:has-author-box',
80
+
$has_author_box
81
+
);
82
+
83
+
return $has_author_box;
84
+
}
85
+
}
86
+
87
+
if (! function_exists('blocksy_single_content')) {
88
+
function blocksy_single_content($content = null) {
89
+
$post_options = blocksy_get_post_options();
90
+
91
+
$prefix = blocksy_manager()->screen->get_prefix();
92
+
93
+
$has_post_tags = blocksy_get_theme_mod(
94
+
$prefix . '_has_post_tags',
95
+
'no'
96
+
) === 'yes';
97
+
98
+
if (
99
+
blocksy_default_akg(
100
+
'disable_post_tags', $post_options, 'no'
101
+
) === 'yes'
102
+
) {
103
+
$has_post_tags = false;
104
+
}
105
+
106
+
$featured_image_location = 'none';
107
+
108
+
$page_title_source = blocksy_get_page_title_source();
109
+
$featured_image_source = blocksy_get_featured_image_source();
110
+
111
+
if ($page_title_source) {
112
+
$actual_type = blocksy_akg_or_customizer(
113
+
'hero_section',
114
+
blocksy_get_page_title_source(),
115
+
'type-1'
116
+
);
117
+
118
+
if ($actual_type !== 'type-2') {
119
+
$featured_image_location = blocksy_get_theme_mod(
120
+
$prefix . '_featured_image_location',
121
+
'above'
122
+
);
123
+
} else {
124
+
$featured_image_location = 'below';
125
+
}
126
+
} else {
127
+
$featured_image_location = 'above';
128
+
}
129
+
130
+
$share_box_type = blocksy_get_theme_mod($prefix . '_share_box_type', 'type-1');
131
+
132
+
$share_box1_location = blocksy_get_theme_mod($prefix . '_share_box1_location', [
133
+
'top' => false,
134
+
'bottom' => true,
135
+
]);
136
+
137
+
$share_box2_location = blocksy_get_theme_mod($prefix . '_share_box2_location', 'right');
138
+
$share_box2_colors = blocksy_get_theme_mod($prefix . '_share_box2_colors', 'custom');
139
+
140
+
$gutenberg_layout_class = "is-layout-constrained";
141
+
142
+
if (blocksy_sidebar_position() !== 'none') {
143
+
$gutenberg_layout_class = "is-layout-flow";
144
+
}
145
+
146
+
$content_class = 'entry-content ' . $gutenberg_layout_class;
147
+
148
+
ob_start();
149
+
150
+
?>
151
+
152
+
<article
153
+
id="post-<?php the_ID(); ?>"
154
+
<?php post_class(); ?>>
155
+
156
+
<?php
157
+
do_action('blocksy:single:top');
158
+
159
+
if ($featured_image_location === 'above') {
160
+
echo blocksy_get_featured_image_output();
161
+
}
162
+
163
+
if (
164
+
! is_singular([ 'product' ])
165
+
&&
166
+
apply_filters('blocksy:single:has-default-hero', true)
167
+
) {
168
+
/**
169
+
* Note to code reviewers: This line doesn't need to be escaped.
170
+
* Function blocksy_output_hero_section() used here escapes the value properly.
171
+
*/
172
+
echo blocksy_output_hero_section([
173
+
'type' => 'type-1'
174
+
]);
175
+
}
176
+
177
+
if ($featured_image_location === 'below') {
178
+
echo blocksy_get_featured_image_output();
179
+
}
180
+
?>
181
+
182
+
<?php if (
183
+
$share_box1_location['top']
184
+
&&
185
+
blocksy_has_share_box()
186
+
) { ?>
187
+
<?php
188
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
189
+
/**
190
+
* Note to code reviewers: This line doesn't need to be escaped.
191
+
* Function blocksy_get_social_share_box() used here escapes the value properly.
192
+
*/
193
+
echo blocksy_get_social_share_box([
194
+
'root_class' => 'is-width-constrained',
195
+
'html_atts' => [ 'data-location' => 'top'],
196
+
'links_wrapper_attr' => $share_box_type === 'type-2' ? [
197
+
'data-color' => $share_box2_colors
198
+
] : [],
199
+
'type' => $share_box_type,
200
+
'enable_shortcut' => true
201
+
]);
202
+
?>
203
+
<?php } ?>
204
+
205
+
<?php do_action('blocksy:single:content:top'); ?>
206
+
207
+
<div class="<?php echo $content_class ?>">
208
+
<?php
209
+
210
+
if (! is_attachment()) {
211
+
if (
212
+
function_exists('blc_get_content_block_that_matches')
213
+
&&
214
+
blc_get_content_block_that_matches([
215
+
'template_type' => 'single',
216
+
'template_subtype' => 'content'
217
+
])
218
+
) {
219
+
$content = blc_render_content_block(
220
+
blc_get_content_block_that_matches([
221
+
'template_type' => 'single',
222
+
'template_subtype' => 'content'
223
+
])
224
+
);
225
+
}
226
+
227
+
if ($content) {
228
+
echo $content;
229
+
} else {
230
+
the_content(
231
+
blocksy_safe_sprintf(
232
+
wp_kses(
233
+
/* translators: 1: span open 2: Name of current post. Only visible to screen readers 3: span closing */
234
+
__(
235
+
'Continue reading%1$s "%2$s"%3$s',
236
+
'blocksy'
237
+
),
238
+
array(
239
+
'span' => array(
240
+
'class' => array(),
241
+
),
242
+
)
243
+
),
244
+
'<span class="screen-reader-text">',
245
+
get_the_title(),
246
+
'</span>'
247
+
)
248
+
);
249
+
}
250
+
} else {
251
+
?>
252
+
<figure class="wp-block-image">
253
+
<?php
254
+
echo blocksy_media([
255
+
'attachment_id' => get_the_ID(),
256
+
'post_id' => get_the_ID(),
257
+
'size' => 'full',
258
+
'tag_name' => 'figure',
259
+
'ratio' => 'original',
260
+
]);
261
+
?>
262
+
263
+
<figcaption class="wp-caption-text">
264
+
<?php
265
+
echo wp_kses_post(wp_get_attachment_caption(get_post_thumbnail_id()));
266
+
267
+
?>
268
+
</figcaption>
269
+
</figure>
270
+
<?php
271
+
remove_filter('the_content', 'prepend_attachment');
272
+
the_content();
273
+
add_filter('the_content', 'prepend_attachment');
274
+
}
275
+
276
+
?>
277
+
</div>
278
+
279
+
<?php
280
+
if (get_post_type() === 'post') {
281
+
edit_post_link(
282
+
blocksy_safe_sprintf(
283
+
/* translators: 1: span opening 2: Post title 3: span closing. */
284
+
__( 'Edit%1$s "%2$s"%3$s', 'blocksy' ),
285
+
'<span class="screen-reader-text">',
286
+
get_the_title(),
287
+
'</span>'
288
+
),
289
+
'',
290
+
'',
291
+
null,
292
+
'post-edit-link is-width-constrained'
293
+
);
294
+
}
295
+
296
+
wp_link_pages(
297
+
[
298
+
'before' => '<div class="page-links is-width-constrained"><span class="post-pages-label">' . esc_html__( 'Pages', 'blocksy' ) . '</span>',
299
+
'after' => '</div>',
300
+
]
301
+
);
302
+
303
+
do_action('blocksy:single:content:bottom');
304
+
?>
305
+
306
+
<?php if ($has_post_tags) { ?>
307
+
<?php
308
+
$class = 'entry-tags is-width-constrained';
309
+
310
+
$class .= ' ' . blocksy_visibility_classes(blocksy_get_theme_mod(
311
+
$prefix . '_post_tags_visibility',
312
+
[
313
+
'desktop' => true,
314
+
'tablet' => true,
315
+
'mobile' => true,
316
+
]
317
+
));
318
+
319
+
$tax_to_check = blocksy_maybe_get_matching_taxonomy(
320
+
get_post_type(),
321
+
false
322
+
);
323
+
$taxonomies_choices = [];
324
+
325
+
if ($tax_to_check) {
326
+
$all_taxonomies = array_values(array_diff(
327
+
get_object_taxonomies(get_post_type()),
328
+
['post_format']
329
+
));
330
+
331
+
foreach ($all_taxonomies as $single_taxonomy) {
332
+
$taxonomy_object = get_taxonomy($single_taxonomy);
333
+
334
+
if (! $taxonomy_object->hierarchical) {
335
+
$taxonomies_choices[] = $single_taxonomy;
336
+
}
337
+
}
338
+
339
+
if (count($taxonomies_choices) > 1) {
340
+
$post_tags_taxonomy = blocksy_get_theme_mod(
341
+
$prefix . '_post_tags_taxonomy',
342
+
$taxonomies_choices[0]
343
+
);
344
+
345
+
if (taxonomy_exists($post_tags_taxonomy)) {
346
+
$tax_to_check = $post_tags_taxonomy;
347
+
}
348
+
}
349
+
}
350
+
351
+
$module_title_default = __('Tags', 'blocksy');
352
+
353
+
if (count($taxonomies_choices) > 0) {
354
+
$taxonomy_object = get_taxonomy($taxonomies_choices[0]);
355
+
356
+
if ($taxonomy_object) {
357
+
$module_title_default = $taxonomy_object->label;
358
+
}
359
+
}
360
+
361
+
$module_title_output = '';
362
+
$module_title = blocksy_get_theme_mod(
363
+
$prefix . '_post_tags_title',
364
+
$module_title_default
365
+
);
366
+
$module_wrapper = blocksy_get_theme_mod($prefix . '_post_tags_title_wrapper', 'span');
367
+
368
+
if (!empty($module_title) || is_customize_preview()) {
369
+
$module_title_output = blocksy_html_tag(
370
+
$module_wrapper,
371
+
[
372
+
'class' => 'ct-module-title'
373
+
],
374
+
$module_title
375
+
);
376
+
}
377
+
378
+
$deep_link_args = blocksy_generic_get_deep_link([
379
+
'prefix' => $prefix,
380
+
'suffix' => $prefix . '_has_post_tags',
381
+
'shortcut' => 'border',
382
+
'return' => 'array'
383
+
]);
384
+
385
+
/**
386
+
* Note to code reviewers: This line doesn't need to be escaped.
387
+
* Function blocksy_post_meta() used here escapes the value properly.
388
+
*/
389
+
if (
390
+
$tax_to_check
391
+
&&
392
+
blocksy_get_categories_list([
393
+
'taxonomy' => $tax_to_check
394
+
])
395
+
&&
396
+
! is_wp_error(blocksy_get_categories_list([
397
+
'taxonomy' => $tax_to_check
398
+
]))
399
+
) {
400
+
echo blocksy_html_tag(
401
+
'div',
402
+
array_merge(
403
+
[
404
+
'class' => $class,
405
+
],
406
+
$deep_link_args
407
+
),
408
+
409
+
$module_title_output .
410
+
411
+
blocksy_html_tag(
412
+
'div',
413
+
[
414
+
'class' => 'entry-tags-items'
415
+
],
416
+
blocksy_get_categories_list([
417
+
'taxonomy' => $tax_to_check,
418
+
'before_each' => '<span>#</span> ',
419
+
'has_term_class' => false
420
+
])
421
+
)
422
+
);
423
+
}
424
+
?>
425
+
<?php } ?>
426
+
427
+
<?php if (
428
+
$share_box1_location['bottom']
429
+
&&
430
+
blocksy_has_share_box()
431
+
) { ?>
432
+
<?php
433
+
/**
434
+
* Note to code reviewers: This line doesn't need to be escaped.
435
+
* Function blocksy_get_social_share_box() used here escapes the value properly.
436
+
*/
437
+
echo blocksy_get_social_share_box([
438
+
'root_class' => 'is-width-constrained',
439
+
'html_atts' => ['data-location' => 'bottom'],
440
+
'links_wrapper_attr' => $share_box_type === 'type-2' ? [
441
+
'data-color' => $share_box2_colors
442
+
] : [],
443
+
'type' => $share_box_type,
444
+
'enable_shortcut' => true
445
+
]);
446
+
?>
447
+
<?php } ?>
448
+
449
+
<?php
450
+
451
+
if (blocksy_has_author_box()) {
452
+
blocksy_author_box();
453
+
}
454
+
455
+
if (blocksy_has_post_nav()) {
456
+
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
457
+
/**
458
+
* Note to code reviewers: This line doesn't need to be escaped.
459
+
* Function blocksy_post_navigation() used here escapes the value properly.
460
+
*/
461
+
echo blocksy_post_navigation();
462
+
}
463
+
464
+
if (function_exists('blc_ext_newsletter_subscribe_form')) {
465
+
if (get_post_type() === 'post') {
466
+
/**
467
+
* Note to code reviewers: This line doesn't need to be escaped.
468
+
* Function blc_ext_newsletter_subscribe_form() used here escapes the value properly.
469
+
*/
470
+
echo blc_ext_newsletter_subscribe_form();
471
+
}
472
+
}
473
+
474
+
blocksy_display_page_elements('contained');
475
+
476
+
do_action('blocksy:single:bottom');
477
+
478
+
?>
479
+
480
+
</article>
481
+
482
+
<?php
483
+
484
+
return ob_get_clean();
485
+
}
486
+
}
487
+
488
+