Advertisement
Guest User

Untitled

a guest
Nov 1st, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <?php
  2.        
  3.             $number     = 10;
  4.             $paged      = (get_query_var('paged')) ? get_query_var('paged') : 1;
  5.             $offset     = ($paged - 1) * $number;
  6.             $users      = get_users();
  7.             $query      = get_users('&offset='.$offset.'&number='.$number);
  8.             $total_users = count($users);
  9.             $total_query = count($query);
  10.             $total_pages = intval($total_users / $number) + 1;
  11.  
  12.             echo '<ul id="users" class="clearfix">';
  13.  
  14.             foreach($query as $q) { ?>
  15.                
  16.                 <li class="user clearfix">
  17.                     <div class="user-avatar">
  18.                         <?php echo get_avatar( $q->ID, 80 ); ?>
  19.                     </div>
  20.                     <div class="user-data">
  21.  
  22.                         <h4 class="user-name">
  23.                             <a href="<?php echo get_author_posts_url($q->ID);?>">
  24.                                 <?php echo get_the_author_meta('display_name', $q->ID);?>
  25.                             </a>
  26.                         </h4>
  27.  
  28.                         <?php if (get_the_author_meta('description', $q->ID) != '') : ?>
  29.                             <p><?php echo get_the_author_meta('description', $q->ID); ?></p>
  30.                         <?php endif; ?>
  31.  
  32.                     </div>
  33.                 </li>
  34.            
  35.             <?php }
  36.  
  37.             echo '</ul>';
  38.  
  39.             ?>
  40.  
  41.             <?php
  42.                 if ($total_users > $total_query) {
  43.                     echo '<div id="pagination" class="clearfix">';
  44.                     echo '<span class="pages">Страницы: </span>';
  45.                       $current_page = max(1, get_query_var('paged'));
  46.                       echo paginate_links(array(
  47.                             'base' => get_pagenum_link(1) . '%_%',
  48.                             'format' => 'page/%#%/',
  49.                             'current' => $current_page,
  50.                             'total' => $total_pages,
  51.                             'prev_next'    => false,
  52.                             'type'         => 'list',
  53.                         ));
  54.                     echo '</div>';
  55.                 }
  56.             ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement