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

83 lines 3.8 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
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));?>" itemprop="url" rel="author">
65 <span itemprop="name"><?php if($key<1){ ?><i class="<?php echo $authorIcon;?>"></i><?php } ?><?php echo esc_html(get_the_author_meta('display_name', $author_id));?><?php if( $key != ( count( $awpa_post_authors ) - 1 ) ){ echo ","; } ?></span>
66 </a>
67 <?php
68 }
69 if($author_type == 'guest'){
70 $wp_amulti_authors = new WPAMultiAuthors();
71 $guest_user_data = $wp_amulti_authors->get_guest_by_id($author_id);?>
72
73 <a class="blockspare-posts-block-text-link">
74 <span itemprop="name"><?php if($key<1){ ?><i class="<?php echo esc_attr($authorIcon);?>"></i><?php } ?><?php echo esc_html($guest_user_data->display_name);?><?php if( $key != ( count( $awpa_post_authors ) - 1 ) ){ echo ","; } ?></span>
75 </a>
76
77 <?php } ?>
78
79 <?php
80 }
81
82 }
83 }