首先获取用户总数:
$total_users = count_users();
//var_dump($total_users); //for debugging purpose
$total_users = $total_users[\'total_users\'];
和当前页面:
$paged = get_query_var(\'paged\');
设置一个变量,该变量将决定每页显示多少用户:
$number = 20; // ie. 20 users page page
然后,如果当前页面!=0,以及要返回的最大用户数:
\'offset\' => $paged ? ($paged - 1) * $number : 0,
\'number\' => $number,
现在从上面添加代码,并创建页面链接:
// display the user list here
if($total_users > $number){
$pl_args = array(
\'base\' => add_query_arg(\'paged\',\'%#%\'),
\'format\' => \'\',
\'total\' => ceil($total_users / $number),
\'current\' => max(1, $paged),
);
// for ".../page/n"
if($GLOBALS[\'wp_rewrite\']->using_permalinks())
$pl_args[\'base\'] = user_trailingslashit(trailingslashit(get_pagenum_link(1)).\'page/%#%/\', \'paged\');
echo paginate_links($pl_args);
}
请参见
paginate_links()
有关参数的完整列表。。。。