PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 2.5.0
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v2.5.0
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
blockspare / inc / block-posts-config / class-multiauthor-frontend.php

class-multiauthor-frontend.php in BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites 2.5.0, at inc/block-posts-config/class-multiauthor-frontend.php

112 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if(!class_exists('BlocksapreMultiAuthorForFrontend')){
3 class BlocksapreMultiAuthorForFrontend{
4
5 function blockspare_front_by_author($post_id,$authorIcon,$xauthor_id){
6
7 if(class_exists('WP_Post_Author')){
8
9
10 $awpa_post_authors = get_post_meta($post_id, 'wpma_author');
11 $enable_author_metabox_for_post = get_option('awpa_author_metabox_integration');
12 $multiauthor_settings = false;
13 if($enable_author_metabox_for_post && $enable_author_metabox_for_post['enable_author_metabox']==true){
14 $multiauthor_settings = true;
15 }
16 //var_dump($awpa_post_authors);
17 if(isset($awpa_post_authors) && !empty($awpa_post_authors) && $multiauthor_settings == true){
18 foreach ($awpa_post_authors as $key=>$author_id) {
19
20 $needle = 'guest-';
21 if (strpos($author_id, $needle) !== false) {
22 $filter_id = substr($author_id, strpos($author_id, "-") + 1);
23 $author_id = $filter_id;
24 $author_type = 'guest';
25 } else {
26 $author_id = $author_id;
27 $author_type = 'default';
28 }
29
30 $this->blockspare_front_author_list($authorIcon,$key,$awpa_post_authors,$post_id,$author_id,$author_type);
31
32 }
33 }else{
34 $author_id = $xauthor_id;
35
36 ?>
37 <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url($xauthor_id));?>"
38 itemprop="url" rel="author">
39 <span itemprop="name">
40 <i class="<?php echo $authorIcon;?>"></i>
41 <?php echo esc_html(get_the_author_meta('display_name', $xauthor_id));?>
42 </span>
43 </a>
44 <?php
45
46
47 }
48 }else{
49 $author_id = $xauthor_id;?>
50 <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url($xauthor_id));?>"
51 itemprop="url" rel="author">
52 <span itemprop="name">
53 <i class="<?php echo $authorIcon;?>"></i>
54 <?php echo esc_html(get_the_author_meta('display_name', $xauthor_id));?>
55 </span>
56 </a>
57 <?php }
58
59 }
60
61
62
63
64 function blockspare_front_author_list($authorIcon, $key, $awpa_post_authors, $post_id='',$author_id='',$author_type=''){
65
66 if($author_type == 'default'){
67 $default_author_id = get_post_field('post_author', $post_id);
68 $author_name = get_userdata( $author_id);
69 ?>
70
71 <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url($author_id));?>"
72 itemprop="url" rel="author">
73 <span itemprop="name">
74 <?php if($key<1){?>
75 <i class="<?php echo $authorIcon;?>"></i>
76 <?php }?>
77 <?php echo esc_html(get_the_author_meta('display_name', $author_id));?>
78 <?php
79 if( $key != ( count( $awpa_post_authors ) - 1 ) ){
80 echo ",";
81 }
82 ?>
83 </span>
84
85 </a>
86 <?php
87 }
88 if($author_type == 'guest'){
89 $wp_amulti_authors = new WPAMultiAuthors();
90 $guest_user_data = $wp_amulti_authors->get_guest_by_id($author_id);?>
91
92 <a class="blockspare-posts-block-text-link">
93 <span itemprop="name">
94 <?php if($key<1){?>
95 <i class="<?php echo esc_attr($authorIcon);?>"></i>
96 <?php }?>
97 <?php echo esc_html($guest_user_data->display_name);?>
98 <?php
99 if( $key != ( count( $awpa_post_authors ) - 1 ) ){
100 echo ",";
101 } ?>
102 </span>
103
104 </a>
105
106 <?php } ?>
107
108 <?php
109 }
110
111 }
112 }