PluginProbe
Powerkit – Supercharge your WordPress Site / 2.4.2
Powerkit – Supercharge your WordPress Site v2.4.2
3.1.1 3.1.0 3.0.9 3.0.8 trunk 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 All 87 releases
powerkit / modules / author-box / public / widget-author-template.php

widget-author-template.php in Powerkit – Supercharge your WordPress Site 2.4.2, at modules/author-box/public/widget-author-template.php

102 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Widget Author Template
4 *
5 * @link https://codesupply.co
6 * @since 1.0.0
7 *
8 * @package PowerKit
9 * @subpackage PowerKit/templates
10 */
11
12 /**
13 * Default Template
14 *
15 * @param int $author The author.
16 * @param array $args Array of args.
17 * @param array $params Array of params.
18 * @param array $instance Widget instance.
19 */
20 function powerkit_widget_author_default_template( $author, $args, $params, $instance ) {
21 // Before Widget.
22 echo $args['before_widget']; // XSS.
23
24 $avatar_size = apply_filters( 'powerkit_widget_author_avatar_size', 80 );
25 ?>
26 <div class="widget-body">
27 <div class="pk-widget-author<?php echo esc_attr( $params['bg_image_id'] ? ' pk-widget-author-with-bg' : '' ); ?>">
28 <?php if ( $params['bg_image_id'] ) { ?>
29 <div class="pk-widget-author-bg">
30 <?php echo wp_get_attachment_image( $params['bg_image_id'], apply_filters( 'powerkit_widget_author_image_size', 'large' ) ); ?>
31 </div>
32 <?php } ?>
33
34 <div class="pk-widget-author-container<?php echo esc_attr( $params['bg_image_id'] ? ' pk-bg-overlay' : '' ); ?>">
35 <?php
36 // Title.
37 if ( $params['title'] ) {
38 $params['widget_title'] = $args['before_title'] . apply_filters( 'widget_title', $params['title'], $instance, 0 ) . $args['after_title']; // XSS.
39
40 echo wp_kses_post( apply_filters( 'powerkit_widget_author_title', $params['widget_title'], $params['title'] ) );
41 }
42 ?>
43
44 <?php $tag = apply_filters( 'powerkit_widget_author_title_tag', 'h5' ); ?>
45
46 <<?php echo esc_html( $tag ); ?> class="pk-author-title">
47 <a href="<?php echo esc_url( get_author_posts_url( $author ) ); ?>" rel="author">
48 <?php echo esc_html( get_the_author_meta( 'display_name', $author ) ); ?>
49 </a>
50 </<?php echo esc_html( $tag ); ?>>
51
52 <?php if ( $params['avatar'] ) { ?>
53 <div class="pk-author-avatar">
54 <a href="<?php echo esc_url( get_author_posts_url( $author ) ); ?>" rel="author">
55 <?php echo get_avatar( $author, $avatar_size ); ?>
56 </a>
57 </div>
58 <?php } ?>
59
60 <div class="pk-author-data">
61 <?php
62 if ( $params['description'] && get_the_author_meta( 'description', $author ) ) {
63 ?>
64 <div class="author-description pk-color-secondary">
65 <?php echo wp_kses_post( powerkit_str_truncate( get_the_author_meta( 'description', $author ), 100 ) ); ?>
66 </div>
67 <?php
68 }
69 if ( $params['social_accounts'] && powerkit_module_enabled( 'social_links' ) ) {
70 powerkit_author_social_links( $author );
71 }
72 ?>
73
74 <?php
75 if ( $params['archive_btn'] ) {
76 $href = get_author_posts_url( $author );
77 $text = apply_filters( 'powerkit_widget_author_button', esc_html__( 'View Posts', 'powerkit' ) );
78
79 if ( isset( $params['is_block'] ) && isset( $params['block_attrs'] ) && $params['is_block'] ) {
80 ?>
81 <div class="pk-author-footer">
82 <?php powerkit_print_gutenberg_blocks_button( $text, $href, '', 'button', $params['block_attrs'] ); ?>
83 </div>
84 <?php
85 } else {
86 ?>
87 <a href="<?php echo esc_url( $href ); ?>" class="pk-author-button button">
88 <?php echo wp_kses( $text, 'post' ); ?>
89 </a>
90 <?php
91 }
92 }
93 ?>
94 </div>
95 </div>
96 </div>
97 </div>
98 <?php
99 // After Widget.
100 echo $args['after_widget']; // XSS.
101 }
102