File: /home/madepabj/gamepointpk.com/wp-content/plugins/groovy-functions/widgets/about.php
<?php
$widget_id = 'epcl_about';
$args = array(
'title' => esc_html_x('(EP) About me', 'admin', 'groovy'),
'classname' => '',
'description' => esc_html_x('Display about author section.', 'admin', 'groovy'),
'fields' => array(
array(
'id' => 'title',
'type' => 'text',
'title' => esc_html_x('Title:', 'admin', 'groovy'),
'default' => 'About Me'
),
array(
'id' => 'position',
'type' => 'text',
'title' => esc_html_x('Position:', 'admin', 'groovy'),
'desc' => esc_html_x('e.g. Founder & Editor', 'admin', 'groovy'),
),
array(
'id' => 'author',
'type' => 'select',
'inline' => true,
'title' => esc_html_x( 'Author:', 'admin', 'groovy'),
'desc' => esc_html_x('Select an author to display all his information. Remember to fill your profile (website, Twitter and Facebook.)', 'admin', 'groovy'),
'options' => 'users'
),
)
);
function epcl_about( $args, $instance ){
// WP 5.9 Patch: always disable widget preview in the backend
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
return false;
}
global $epcl_theme;
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$author_id = $instance['author'];
echo $before_widget;
if($title) echo $before_title.$title.$after_title;
if( $author_id ):
$user_meta = get_user_meta( $author_id, 'epcl_user', true );
$author_name = get_the_author_meta('display_name', $author_id);
$author_url = get_author_posts_url($author_id);
$author_avatar = epcl_get_author_avatar($user_meta, $author_id);
$website = get_the_author_meta('user_url', $author_id);
?>
<?php if($author_avatar): ?>
<div class="avatar">
<a href="<?php echo esc_url( $author_url ); ?>" class="shadow-effect thumb"><span class="fullimage cover" style="background-image: url(<?php echo esc_url( $author_avatar ); ?>)"></span></a>
</div>
<?php else: ?>
<a href="<?php echo get_author_posts_url($author_id); ?>" title="<?php echo esc_attr__('Author:', 'groovy').' '.esc_attr($author_name); ?>" class="epcl-dropcap rounded no-border large author-avatar avatar translate-effect">
<span><?php echo mb_substr( $author_name, 0, 1); ?></span>
</a>
<?php endif; ?>
<div class="info">
<h4 class="title small underline-effect author-name no-margin"><a href="<?php echo esc_url( $author_url ); ?>"><?php echo esc_html( $author_name ); ?></a></h4>
<?php if( isset( $instance['position'] ) ): ?>
<p class="founder"><?php echo esc_html( $instance['position'] ); ?></p>
<?php endif; ?>
<div class="social">
<?php if( isset($user_meta['twitter']) && $user_meta['twitter'] ): ?>
<a href="<?php echo esc_url( $user_meta['twitter'] ); ?>" class="twitter tooltip" title="<?php esc_attr_e('Follow me on Twitter', 'groovy'); ?>" target="_blank"><i class="fa fa-twitter"></i></a>
<?php endif; ?>
<?php if( isset($user_meta['facebook']) && $user_meta['facebook'] ): ?>
<a href="<?php echo esc_url( $user_meta['facebook'] ); ?>" class="facebook tooltip" title="<?php esc_attr_e('Follow me on Facebook', 'groovy'); ?>" target="_blank"><i class="fa fa-facebook"></i></a>
<?php endif; ?>
<?php if($website): ?>
<a href="<?php echo esc_url($website); ?>" class="website tooltip" title="<?php esc_attr_e('Website', 'groovy'); ?>: <?php echo esc_url($website); ?>" target="_blank"><i class="fa fa-globe"></i></a>
<?php endif; ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
<p><?php the_author_meta('description', $author_id); ?></p>
<?php
endif;
echo $after_widget;
}
$wp_widget_factory->register( EPCL_CreateWidget::instance( $widget_id, $args ) );