llms_get_author( array $args = array() )
Retrieve author name, avatar, and bio
Parameters Parameters
- $args
-
(array) (Optional) arguments
Default value: array()
Return Return
(string)
Source Source
File: includes/llms.template.functions.php
function llms_get_author( $args = array() ) { $args = wp_parse_args( $args, array( 'avatar' => true, 'avatar_size' => 96, 'bio' => false, 'label' => '', 'user_id' => get_the_author_meta( 'ID' ), ) ); $name = get_the_author_meta( 'display_name', $args['user_id'] ); if ( $args['avatar'] ) { $img = get_avatar( $args['user_id'], $args['avatar_size'], apply_filters( 'lifterlms_author_avatar_placeholder', '' ), $name ); } else { $img = ''; } $img = apply_filters( 'llms_get_author_image', $img ); $desc = ''; if ( $args['bio'] ) { $desc = get_the_author_meta( 'description', $args['user_id'] ); } ob_start(); ?> <div class="llms-author"> <?php echo $img; ?> <span class="llms-author-info name"><?php echo $name; ?></span> <?php if ( $args['label'] ) : ?> <span class="llms-author-info label"><?php echo $args['label']; ?></span> <?php endif; ?> <?php if ( $desc ) : ?> <p class="llms-author-info bio"><?php echo $desc; ?></p> <?php endif; ?> </div> <?php $html = ob_get_clean(); return apply_filters( 'llms_get_author', $html ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |