Lists of users with Pagination

The sample code of pagination with get_users query.

Thumbnail

PHP
<div class="uk-grid-small uk-margin-medium-bottom uk-grid-match uk-child-width-1-4@l uk-child-width-1-3@m uk-child-width-1-2@s" uk-grid>
  <?php 
  $number = get_option('posts_per_page',);
  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  $offset = ($paged - 1) * $number;
  $users = get_users(array('role__in' => array('author','innews_admin')));
  $args = array(
    'offset' => $offset,
    'number' => $number,
    'role__in' => array('author','innews_admin')
  );
  $query = get_users($args);
  $total_users = count($users);
  $total_query = count($query);
  $total_pages = ($total_users / $number);
  foreach ( $query as $user ): ?>
    <div>
      <a class="uk-background-muted uk-padding-default uk-position-relative uk-display-block" href="<?php echo esc_url(home_url().'/author/'.$user->user_login); ?>">
      <img class="uk-position-top-center" src="<?php echo get_template_directory_uri(); ?>/assets/img/icon-hot_news.svg" style="transform: translateX(-50%) scale(1.5,1.8); top: 8px;">
        <p class="uk-text-center uk-margin-medium-top uk-margin-bottom text-default uk-text-primary text-large-weight text-small-spacing"><?php echo get_field('author_job','user_'.$user->ID); ?></p>
        <p class="uk-text-center uk-margin-bottom text-dark text-xxlarge text-large-weight text-small-spacing"><?php echo esc_html($user->display_name); ?></p>
        <p class="uk-text-center uk-margin-bottom text-small text-large-weight text-small-spacing" style="color:#606060"><?php echo esc_html(get_user_meta($user->ID,'description',true)); ?></p>
        <p class="uk-text-center uk-margin-bottom"><span class="uk-background-cover uk-display-block uk-margin-auto" data-src="<?php echo (get_field('author_avatar','user_'.$user->ID))?get_field('author_avatar','user_'.$user->ID)['url']:get_template_directory_uri().'/assets/img/default_image.png'; ?>" uk-img style="width:107px;height:107px;border-radius:100%;"></span></p>
    </a>
  </div>
  <?php endforeach; ?>
</div>
<?php
if ($total_users > $total_query) {
  $pages = paginate_links( array(
    'base' => get_pagenum_link(1) . '%_%',
    'format' => '?paged=%#%',
    'current' => max(1, get_query_var('paged')),
    'total' => is_float($total_pages) ? intval($total_users / $number) + 1 : intval($total_users / $number),
    'type'  => 'array',
    'prev_text' =>'<span uk-pagination-previous></span>',
    'next_text' =>'<span uk-pagination-next></span>',
  ));
  if( is_array( $pages ) ) {
    echo '<ul class="uk-pagination uk-flex-center">';
    foreach ( $pages as $page ) {
        echo "<li>$page</li>";
    }
    echo '</ul>';
    echo '<script>jQuery(".page-numbers.current").wrap("<a href></a>");jQuery(".page-numbers.current").parent().parent().addClass("uk-active")</script>';
  }
}
?>