go41

Re: How to display grid of authors :: Reply by Joern

von Joern am 13. Jul. 2010 | Keine Kommentare

list_authors is now wp_list_authors and loops in itself with some arguments you can set.

So here you can’t include the image of the ‚user photo‘ plugin (userphoto_the_author_photo).
You have to create a custom loop, a sample query for users you find here:

List user sorted by last name: http://wordpress.org/support/topic/327359

<?php
$lastnames = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key = ‚last_name‘ ORDER BY $wpdb->usermeta.meta_value ASC");
foreach ($lastnames as $userid) {
$user = get_userdata($userid);
$post_count = get_usernumposts($user->ID);
$author_posts_url = get_author_posts_url($user->ID);
echo ‚<li><a href="‘ . $author_posts_url . ‚">‘ . $user->user_firstname . ‚ ‚ . $user->user_lastname . ‚</a> (‚ . $post_count . ‚) </li>‘;
}
?>
try this query first, no image yet
If you get a list of your users (authors), you should try something like
<?php userphoto($user->ID); ?> or
echo userphoto($user->ID);
inside the above loop
code above from: http://wordpress.org/extend/plugins/user-photo/

If you want to display the user’s photo in the sidebar, just get the user ID or object and pass it into userphoto() or userphoto_thumbnail()

I would also have to try..
EDIT:

just found another code snippet:
<?php
$authors = $wpdb->get_results("SELECT ID from $wpdb->users " . ($exclude_admin ? "WHERE user_login <> ‚admin‘ " : “) . "ORDER BY display_name");
$author_count = array();
echo "<ul>";
foreach ( (array) $authors as $author ) {
$author = get_userdata( $author->ID );
$posts = (isset($author_count[$author->ID])) ? $author_count[$author->ID] : 0;
$name = $author->display_name;
echo "<li>" . userphoto_thumbnail($author->ID, ‚ ‚, ‚ ‚, array(style => ‚border:0‘)) . " " . $user->display_name . "</li>";

echo "</ul>";

}
?>
you might just replace userphoto_thumbnail(.. with userphoto(.. in the code given

source: http://www.sitepoint.com/forums/showthread.php?t=588271
____________________
you find me on Google+, Twitter and Facebook

(von: Joern)

Hier noch 3 weitere Ergebnisse dieses Threads:

How to display grid of authors

13. Jul. 2010 (von: adamwork)

I understand that you can use <?php list_authors(TRUE, TRUE, TRUE); ?> to display the list of all the authors on the site. But how would you go about setting up a grid with a picture of each author, their name,…

Re: How to display grid of authors :: Reply by adamwork

13. Jul. 2010 (von: adamwork)

joern thanks for getting back. the top version works well, but displays the admin.the bottom version is good, but only displays the first name over and over again.Therefore, how can I include the exlude admin into the first one?also, where…

Re: How to display grid of authors :: Reply by Joern

13. Jul. 2010 (von: Joern)

no idea how to exclude the admin in top query, you could do something like this inside the loop, it will jump the author with id=1:Code:if ( '1' == $author->ID ) { continue;}no idea again if following code will show…

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


weitere forum Beiträge: