How to display list of authors in WordPress without a Plugin

On 15 Sep, 2011 By With 14 Comments

Working on a Clients Membership Website, one of the requirements was to display the authors in the WordPress site. Today I will show you how I achieve to display the author the author list and without using a plugin. If you want to create a author contact form, I also created a tutorial about that.

There may be other way, or proper way to do it. But this one works for me, if there are WordPress ninjas out there hope you can spare some time to correct my code.

How to display list of authors in Wordpress without a Plugin How to display list of authors in Wordpress without a Plugin

My first choice was to use

because the WordPress codex says:

Displays a list of the sites’s authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author’s post count and RSS feed link.

But there is a problem; this doesn’t display the user photo or gravatar which is not good for the author list. Bavotasan wrote a wonderful custom function to list all authors with gravatars or user photo, and it is working fine until I tried to sign up on the website and my name was shown on the advisors list. And that’s when I though I needed a new function that will only show the real advisors.

Upon searching Google, I ended up looking on Codex and saw this

According to the definition: Retrieves an array of users matching the criteria given in $args.

Now that’s a relief! But it doesn’t fit the website needs; I need to display the author with gravatar or user photo. I tried to look at Bavotasan code and try to modify it a little.

Here is what I came up with:

I will try to explain the code, I used the codex sample and mix it up a little.

In this code we set the parameters to authors only.

This code will grab the url of our author ID, so if our user click the author image they will be directed to the author’s page.

This one display’s the author’s name.

You can also sort the authors depending on your needs, mine was to sort them from the clients order; so what I did is change the nicename to registered. Here are the choices to sort by ‘nicename‘, ‘email‘, ‘url‘, ‘registered‘, ‘display_name‘, or ‘post_count‘.

How to use

If you want to use this, just create a new page template and paste the code above. Guys at WPBeginner wrote an awesome tutorial about that. As for the CSS, this will do. Make sure that you wrap the code with <div class=”advisor_list”>.

I think this is really useful for websites that wanted to display author’s list in wordpress without relying on a plugin. Also you show your author’s list if you put this on a sidebar, make sure that you are using Php Code Widget by Otto.

How do you display your author’s profile in your website? Do you use plugins or custom functions as well? Feel free to add them on the comments!

14 Responses to “How to display list of authors in WordPress without a Plugin”