List of all website authors

List of all website authors

Maybe rare to use, but here is shortcode to generate page:

function wpog_lista_autora(){
// WP_User_Query arguments
$args = array(
‘order’          => ‘DESC’,
‘orderby’        => ‘post_count’,
‘count_total’    => true,
‘exclude’        => array( 197,220,213,212,187,216,206,192,223,205,198,16,289,288,228,235,164,12,161 ),
);
// The User Query
$user_query = new WP_User_Query( $args );
// The User Loop
if ( ! empty( $user_query->results ) ) {
foreach ( $user_query->results as $user ) {
$author_id = $user->ID;
$author_avatar = get_field(‘slika’, ‘user_’. $author_id );
$avatar_url = $author_avatar[‘sizes’][‘thumbnail’];
$counter = count_user_posts($author_id);
$author_url = get_author_posts_url($author_id);
if (!($author_avatar)) { $avatar_url=’https://domain.com/default.jpg’; }
echo “<div class=’autorbox’>”;
echo “<img src='”. $avatar_url .”‘ alt=’avatar’ class=’autoravatar’>”;
echo “<p class=’autorname’>” . $user->display_name . “</p>”;
echo “<a href='” . $author_url . “‘ class=’autorurl’>Pregled ” . $counter . ” članaka</a>”;
echo “</div>”;
}
} else {
echo ‘Nema korisnika’;
}
}
add_shortcode(‘lista_autora’, ‘wpog_lista_autora’);
Twitter
Facebook
LinkedIn
Telegram
WhatsApp
Email