/home/fdhrevqn/public_html/wp-content/plugins.disabled/fox-framework/addons/authors/frontend.php
<?php
$settings = $this->get_settings_for_display();
extract( wp_parse_args( $settings, [
// query options
'number' => '',
'orderby' => '',
'order' => '',
'include' => '',
// layout
'layout' => '',
'column' => '',
'align' => '',
'text_color' => '',
'border' => 'yes',
'border_color' => '#c0c0c0',
// components
'show_author_avatar' => 'yes',
'author_avatar_shape' => 'circle',
'show_author_name' => 'yes',
'show_author_description' => 'yes',
'author_description_size' => 'normal',
'show_author_social' => 'yes',
'author_social_style' => '',
// 'show_post_count' => false,
// 'recent_posts' => 0, @todo
] ) );
$args = array(
'number' => $number,
'has_published_posts' => true,
'orderby' => $orderby,
'order' => $order,
);
$include = trim( $include );
if ( ! empty( $include ) ) {
$include = explode( ',', $include );
$include = array_map( 'absint', $include );
$args = [ 'include' => $include ];
$args[ 'orderby' ] = 'include';
}
// The Query
$user_query = new WP_User_Query( $args );
if ( empty( $user_query->get_results() ) ) {
echo '<div class="fox-error">' . esc_html__( 'No users found', 'wi' ) . '</div>';
return;
}
// LAYOUT
$class = [
'fox-authors',
'fox-users',
];
$css = [];
if ( 'list' != $layout ) $layout = 'grid';
$class[] = 'fox-authors-' . $layout;
if ( 'grid' == $layout ) {
// column
if ( $column < 1 || $column > 5 ) $column = 3;
$class[] = 'column-' . $column;
// align
if ( 'center' != $align && 'right' != $align ) $align = 'left';
$class[] = 'align-' . $align;
}
// author_description_size
if ( 'small' != $author_description_size ) {
$author_description_size = 'normal';
}
$class[] = 'style--description-size-' . $author_description_size;
// text_color
if ( $text_color ) {
$css[] = 'color:' . $text_color ;
}
$css = join( ';', $css );
if ( ! empty( $css ) ) {
$css = ' style="' . esc_attr( $css ). '"';
}
// line css
$line_css = '';
if ( $border_color ) {
$line_css = ' style="background-color:' . $border_color . '"';
}
// avatar shape
if ( 'round' != $author_avatar_shape && 'acute' != $author_avatar_shape ) $author_avatar_shape = 'circle';
?>
<div class="fox-authors-wrapper">
<div class="<?php echo esc_attr( join( ' ', $class ) ); ?>"<?php echo $css; ?>>
<?php foreach ( $user_query->get_results() as $user ) :
if ( 'yes' == $border && 'list' == $layout ) { ?>
<div class="line"<?php echo $line_css; ?>></div>
<?php } // list border
fox_user([
'user' => $user,
'avatar' => ('yes' == $show_author_avatar ),
'avatar_shape' => $author_avatar_shape,
'name' => ( 'yes' == $show_author_name ),
'description' => ( 'yes' == $show_author_description ),
'social' => ( 'yes' == $show_author_social ),
'social_style' => $author_social_style,
]);
endforeach; // each user ?>
<?php if ( 'yes' == $border && 'grid' == $layout ) { for ( $i = 1; $i < $column; $i++ ) { ?>
<div class="line line-<?php echo $i; ?>"<?php echo $line_css; ?>></div>
<?php } } ?>
</div><!-- .fox-authors -->
</div><!-- .fox-authors-wrapper -->