authors listing, add DIV tag to PHP?
-
Hello,
I found this awesome code that MichaelH provided for another user about a year ago to create a list of authors with avatar, user, and 3 most recent posts.
<?php //displays all users with their avatar and 3 of their posts (titles) $blogusers = get_users_of_blog(); if ($blogusers) { foreach ($blogusers as $bloguser) { $user = get_userdata($bloguser->user_id); echo '<p>User ID ' . $user->ID . ' ' . $user->user_firstname . ' ' . $user->user_lastname . '</p>'; echo get_avatar( $user->ID, 46 ); $args=array( 'author' => $user->ID, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 3, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname; while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). } } ?>
Works like a charm! I was just wondering if it was possible to wrap each user’s information (avatar, name & recent post links) inside a DIV and the list of recent post links inside UL/LI tags? I’m a PHP newbie and I keep breaking my sidebar trying to figure this out. Any help is greatly appreciated, thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘authors listing, add DIV tag to PHP?’ is closed to new replies.