Hi there- thanks for reading.
I'm trying to display two randomly chosen blog authors from a site on its homepage. I'm trying to get them to display as gravatars, and names.
Unfortunately, my php skills are weak- I've built this, which displays all the authors, fine, but I'm not sure how to make it just choose a random author.
<?php $order = 'user_nicename'; $user_ids = $wpdb->get_col("SELECT ID FROM $wpdb->users ORDER BY $order"); // query users foreach($user_ids as $user_id) : // start authors' profile "loop" $user = get_userdata($user_id); ?> <div class="mugshot"> <?php echo '<a href="' . $user->yim . '">'; echo get_avatar( $user->user_email, '60', 'http://no-image.jpg' ); echo '<br />' . $user->nickname . '</a>'; ?> </div> <?php endforeach; // end of authors' profile 'loop' ?>
(I'm using the
$user->yim (yahoo IM) field to contain the address of the author page, so users can click through from the homepage)
If anybody can help me with a push in the right direction, or if people have done similar things in the past- I'd be really happy.