WordPress has a core function that allows for the display of all of the site’s “authors” by a simple code insertion (from the codex)
1 |
<?php wp_list_authors( $args ); ?> |
This can be further refined by inserting a string of parameters:
orderby
name – display_name from users table – default
email – user_email from users table
url – user_url from users table
registered – user_registered date from users table
id – ID from users table
user_login – user_login from users table
post_count – based on number of posts by user
order
ASC
DESC
number
(list integer)
optioncount
(boolean) Display number of published posts by each author. Valid values:
1 (true)
0 (false) – default
exclude_admin
(boolean) Exclude the ‘admin’ (login is admin) account from the list. Valid values:
1 (true) – default
0 (false)
hide_empty
(boolean) Do not display authors with 0 posts. Valid values:
1 (true) – default
0 (false)
echo
(boolean) Display the results. Valid values:
1 (true) – default
0 (false)
feed
(string) Text to display for a link to each author’s RSS feed. Default is no text, and no feed displayed.
feed_image
(string) Path/filename for a graphic. This acts as a link to each author’s RSS feed, and overrides the feed parameter.
feed_type
(string) The type of feed.. An empty string is the default. Valid values:
– default.
rss2
atom
rss
rdf
style
(string) Style in which to display the author list. A value of list, the default, displays the authors as an unordered list, while none generates no special display method (the list items are separated by comma). If html is false, this option is ignored. Valid values:
list – default.
none
html
(boolean) Whether to list the items in html or plaintext. The default setting is true. If html is false, the style setting is ignored and the items are returned, separated by comma. Valid values:
1 (true) – defaul
>0 (false)
These parameters can be strung together like this:
1 2 3 |
<?php wp_list_authors('show_fullname=1&orderby=name&order=ASC&number=20&hide_empty=0'); ?> //OR <?php wp_list_authors('show_fullname=1&orderby=name&order=DESC&number=7&hide_empty=0'); ?> |
Now this is all fine and good until you start looking into such things as adding avatars, excluding different authors, etc. And there are quite a few methodologies that do a pretty goo job of controlling these factors – here are a couple of examples:
But truth be told, there is a wonderful plugin that addresses most of the issues you would want to control right here
The plugin is written with pulling a list of authors into the widget region, but if you follow this link you will find instructions on how to compose shortcodes for insertion in pages and posts.
So for example, this would be the short code:
1 |
[authoravatars hiddenusers=multidog,beoptimalhealth,wordydog show_name=true] |
And this would be the same thing inserted in a theme template file:
1 |
<?php echo do_shortcode("[authoravatars hiddenusers=multidog,beoptimalhealth,wordydog show_name=true]"); ?> |
… a quick word on gravitars …
If you don’t want to use the gravitar service to store your images but would rather use images that are inserted into the media manager, this plugin will be your friend.
HOWEVER….
sometimes the standard gravitar insertion like this:
1 |
<?php echo get_avatar($post->post_author, '120', $avatar); ?> |
will not respond correctly, so instead use this code:
1 |
<?php echo get_wp_user_avatar($post->post_author, '120', $avatar); ?> |
AND …. make sure that you activate the “show avatars” checkbox in the plugin settings display!!!