WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

WordPress has a built in function to display a list of all of your site’s authors. But there is no option to display their avatars, so all you really get is a text list that links to the author’s page, if you have an author.php file in your theme, that is.

thus turning the internet I found this nice tutorial bavotasan.com with a little piece of code that seems to do the trick.

On my site all users can write articles and list of contributors is long. It’s possible set 10 users for page ?

Using this solution: Paginate result set from $wpdb->get_results()

I did make my code for Authors list functions as follow:

    function contributors() {
global $wpdb;

$authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' ORDER BY display_name");

$authors_per_page = 10;
$page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;

echo paginate_links( array(
    'base' => add_query_arg( 'cpage', '%#%' ),
    'format' => '',
    'prev_text' => __('«'),
    'next_text' => __('»'),
    'total' => ceil($total / $authors_per_page),
    'current' => $page

foreach ($authors as $author ) {

echo "<li>";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
echo get_avatar($author->ID);
echo "</a>";
echo '<div>';
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">";
the_author_meta('display_name', $author->ID);
echo "</a>";
echo "<br />";
echo "SitoWeb: <a href=\"";
the_author_meta('user_url', $author->ID);
echo "/\" target='_blank'>";
the_author_meta('user_url', $author->ID);
echo "</a>";
echo "<br />";
echo "Twitter: <a href=\"http://twitter.com/";
the_author_meta('twitter', $author->ID);
echo "\" target='_blank'>";
the_author_meta('twitter', $author->ID);
echo "</a>";
echo "<br />";
echo "<a href=\"".get_bloginfo('url')."/author/";
the_author_meta('user_nicename', $author->ID);
echo "/\">Visita il Profilo di ";
the_author_meta('display_name', $author->ID);
echo "</a>";
echo "</div>";
echo "</li>";

but still does the trick ..... Please help me to find out the error and its rectification. Thanks a lot.

share|improve this question
Could you tell us what exactly is not working? Is there no pagination at all? Or is there wrong pagination? – Lea Cohen Mar 14 '11 at 12:07
this is the test page, xrl.in/7gej Is there no pagination at all. this is my custom template: xrl.in/7gey. I do not know how to call the function – Fask Mar 14 '11 at 13:45
is there any reason to use "cpage" insted of "page"? and if you are using "cpage" you need to take care of the rewrite rules. – Bainternet Mar 14 '11 at 19:26
up vote 0 down vote accepted

I have modified WP_LIST_AUTHORS to paginate. I don't know if its very sexy, and seems to require some sort of Caching plugin otherwise this particular page can start to load pretty slowly.

The full code of my paginated function is in this thread: Modifying WP_LIST_AUTHOR Functions to output all users in a grid (and Paginate)

If you just want to look directly at the pagination code I used you can go here: http://www.phpfreaks.com/tutorial/basic-pagination

share|improve this answer
ok I found a very clean solution: youtube.com/watch?v=R-AQ_HBYZbc&feature=relmfu – Fask Jun 7 '11 at 8:21

In your case you can save your time the trouble by using Members List Plugin

which allows you to create a post on your wordpress blog that lists all your wordpress members. When viewing the list of members you can also search through your members according to first name, last name, email address, URL or any other number of user meta fields you may specify. Employing pagination you can page through your search results and sort your results according to last name, first name, registration date or email.

share|improve this answer
thanks Bainternet, I was aware of the plugin but I will not use it for a problem page. I think with a little help we can get the solution .... that will be useful to many users. – Fask Mar 14 '11 at 15:50
ugh... i'm already 90% to having this done and NOW i find the plugin. +1 – helgatheviking Aug 27 '12 at 3:01

if I add this code as I recall it in the loop?

// Get the current page
$paged = get_query_var('paged');
if (!$paged) $paged = 1;

// We'll return these at a later stage
$current_page = $paged;
$total_pages = ceil(count($authors) / 10);

// Calculate the starting and ending points
// Assuming we'll be showing 10 authors per page
$start = ($paged - 1) * 10;
$end = $paged * 10;
if ($end > count($authors)) $end = count($authors);
share|improve this answer
this has nothing to do with the pagination – Bainternet Mar 14 '11 at 19:24
Please add details and updates (anything that is not working answer you possibly came up with) to the original question. – Rarst Apr 14 '11 at 14:52
ok Rast. I found a very clean solution: youtube.com/watch?v=R-AQ_HBYZbc&feature=relmfu – Fask Jun 7 '11 at 8:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.