PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 2.6.6
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v2.6.6
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.6.6, at inc/block-posts-config/class-multiauthor-frontend.php

105 lines 4.3 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"><i class="<?php echo $authorIcon;?>"></i><?php echo esc_html(get_the_author_meta('display_name', $xauthor_id));?></span>
40 </a>
41 <?php
42
43
44 }
45 }else{
46 $author_id = $xauthor_id;?>
47 <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url($xauthor_id));?>" itemprop="url" rel="author">
48 <span itemprop="name"><i class="<?php echo $authorIcon;?>"></i><?php echo esc_html(get_the_author_meta('display_name', $xauthor_id));?></span>
49 </a>
50 <?php }
51
52 }
53
54
55
56
57 function blockspare_front_author_list($authorIcon, $key, $awpa_post_authors, $post_id='',$author_id='',$author_type=''){
58
59 if($author_type == 'default'){
60 $default_author_id = get_post_field('post_author', $post_id);
61 $author_name = get_userdata( $author_id);
62 ?>
63
64 <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url($author_id));?>"
65 itemprop="url" rel="author">
66 <span itemprop="name">
67 <?php if($key<1){ ?>
68 <i class="<?php echo $authorIcon;?>"></i>
69 <?php } ?>
70 <?php echo esc_html(get_the_author_meta('display_name', $author_id));?>
71 <?php
72 if( $key != ( count( $awpa_post_authors ) - 1 ) ){
73 echo ",";
74 }
75 ?>
76 </span>
77
78 </a>
79 <?php
80 }
81 if($author_type == 'guest'){
82 $wp_amulti_authors = new WPAMultiAuthors();
83 $guest_user_data = $wp_amulti_authors->get_guest_by_id($author_id);?>
84
85 <a class="blockspare-posts-block-text-link">
86 <span itemprop="name">
87 <?php if($key<1){ ?>
88 <i class="<?php echo esc_attr($authorIcon);?>"></i>
89 <?php } ?>
90 <?php echo esc_html($guest_user_data->display_name);?>
91 <?php
92 if( $key != ( count( $awpa_post_authors ) - 1 ) ){
93 echo ",";
94 } ?>
95 </span>
96
97 </a>
98
99 <?php } ?>
100
101 <?php
102 }
103
104 }
105 }