Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/inc/integrations/coauthors.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 +
3 + if (! function_exists('coauthors__echo')) {
4 + return;
5 + }
6 +
7 + add_filter(
8 + 'blocksy:post_meta:author_output',
9 + function($output, $with_iamge = true, $meta_label = '') {
10 + $author_output = '';
11 +
12 + if ($with_iamge) {
13 + $author_output .= coauthors__echo(
14 + 'blocksy_render_post_author_avatar',
15 + 'callback',
16 + [
17 + 'between' => '',
18 + 'betweenLast' => '',
19 + 'before' => '',
20 + 'after' => '',
21 + ],
22 + null,
23 + false
24 + );
25 + }
26 +
27 + $author_output .= coauthors__echo(
28 + 'blocksy_render_post_author_details',
29 + 'callback',
30 + [
31 + 'between' => ', ',
32 + 'betweenLast' => __(' and ', 'blocksy'),
33 + 'before' => $meta_label,
34 + 'after' => '',
35 + ],
36 + null,
37 + false
38 + );
39 +
40 + return $author_output;
41 + },
42 + 10,
43 + 3
44 + );
45 +
46 + add_filter(
47 + 'blocksy:author:count_user_posts',
48 + function($result, $author_id) {
49 + if (
50 + ! class_exists('\CoAuthors_Plus')
51 + ||
52 + ! class_exists('\CoAuthors_Guest_Authors')
53 + ) {
54 + return $result;
55 + }
56 +
57 + $coguest = new \CoAuthors_Guest_Authors();
58 +
59 + $guest_author = $coguest->get_guest_author_by('ID', $author_id);
60 +
61 + if (! $guest_author) {
62 + return $result;
63 + }
64 +
65 + $coauthor = new \CoAuthors_Plus();
66 +
67 + return $coauthor->get_guest_author_post_count($guest_author);
68 + },
69 + 10, 2
70 + );
71 +
72 + add_filter(
73 + 'blocksy:author:get_the_author_meta',
74 + function ($result, $field, $author_id) {
75 + if (
76 + ! class_exists('\CoAuthors_Plus')
77 + ||
78 + ! class_exists('\CoAuthors_Guest_Authors')
79 + ) {
80 + return $result;
81 + }
82 +
83 + $coguest = new \CoAuthors_Guest_Authors();
84 +
85 + $guest_author = $coguest->get_guest_author_by('ID', $author_id);
86 +
87 + if (! $guest_author || ! isset($guest_author->$field)) {
88 + return $result;
89 + }
90 +
91 + return $guest_author->$field;
92 + },
93 + 10, 3
94 + );
95 +
96 +