Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 3rd, 2012  |  syntax: PHP  |  size: 1.14 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. //displays all users with their avatar and their posts (titles)
  3. $blogusers = get_users_of_blog();
  4. if ($blogusers) {
  5.   foreach ($blogusers as $bloguser) {
  6.     echo '<div class="content-slider-body">';
  7.     $user = get_userdata($bloguser->user_id);
  8.     echo get_avatar( $user->ID, 64 );
  9.     $args=array(
  10.       'author' => $user->ID,
  11.       'post_type' => 'post',
  12.       'post_status' => 'publish',
  13.       'posts_per_page' => 1,
  14.       'caller_get_posts'=> 1
  15.     );
  16.     $my_query = null;
  17.     $my_query = new WP_Query($args);
  18.     if( $my_query->have_posts() ) {
  19.       //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;
  20.       while ($my_query->have_posts()) : $my_query->the_post(); ?>
  21.         <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to     <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br /><?php the_excerpt(); ?></p>
  22.  
  23.     <?php echo '<span class="rsTmb">' . $user->user_firstname . ' ' . $user->user_lastname . '</span>'; ?>
  24.         </div>
  25.         <?php
  26.       endwhile;
  27.     }
  28.   wp_reset_query();  // Restore global post data stomped by the_post().
  29.   }
  30. }
  31. ?>
clone this paste RAW Paste Data