I would like to create a piece of code that loops through each Author in my Wordpress blog. I'm a complete novice with PHP, but basically I want to list all of the Authors in an unordered list, with their Photograph, and then their name. Both the photograph and the name need to be a hyperlink that points to the Author page. I've worked out how to display a single Author's photo. It is as follows (the $user variable is the Author ID) `<?php userphoto_thumbnail($user, ' ', ' ', array(style => 'border:0')) ?>` PHP: From previous research, it seems that this is how you list all Author usernames as a list of hyperlinks to their respective pages, though I don't think it's going to help me in this instance `<?php wp_list_authors('exclude_admin=0'); ?> ` PHP: Could anyone help me write the loop code, pretty please?
Hi there, I did not test this but it should work: <?php $results = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->wp_users"); echo "<ul>"; foreach ($results as $user) { echo "<li>" . userphoto_thumbnail($user->ID, ' ', ' ', array(style => 'border:0')) . " " . $user->display_name . "</li>"; } echo "</ul>"; ?> PHP: You still need to tweak it a bit using CSS, though. Good luck!
Thanks for the quick response, although I couldn't get this code to work unfortunately... Not sure if this info has any bearing on things... http://codex.wordpress.org/Template_Tags/wp_list_authors
Since this code isn't working (and I'm hopeless at PHP) - how can I debug this piece of code? I think I should try and output the $results variable within the loop, I tried putting echo $results; under the foreach line but nothing printed (it's behind in the php file of this page http://www.helloelbow.com/the-crew/ )
Does anyone else have a suggestion for a loop that will list the Author IDs for all existing Wordpress authors?
This isn't completely what you require but may help you http:// wordpress.org /extend/ plugins/ author-listing/ Just remove the spaces to get the link, I do not have enough posts to insert live links ATB George