WordPress.org

Ready to get started?Download WordPress

Forums

Display Last 5 posts from multiple WP Authors -- HELP! (6 posts)

  1. cent
    Member
    Posted 7 years ago #

    Hi.

    I set up a few friends as authors on my blog. I would like to have a Page in which it shows a number of blocks. Each block would contain:
    - Author Name
    - Author About Info
    - Last 5 posts by that Author

    My problem is that I don't know how to create the loop necessary.

    I know I can get the list of authors with:
    <?php wp_list_authors('show_fullname=1&optioncount=1'); ?>

    And their About info with
    <?php the_author_description(); ?>

    And their Last 5 posts with
    <?php wp_get_archives('type=postbypost&limit=5'); ?>

    I know I will need to create some kind of Loop which will:
    - Query DB for authors

    Start: Loop 1
    - Set some type of author id variable
    - Get the Author's about info

    Start: Loop 2
    - Query archives to find their last 5 posts
    End: Loop 2

    End: Loop 1

    Any help would be appreciated.

  2. moshu
    Member
    Posted 7 years ago #

  3. cent
    Member
    Posted 7 years ago #

    Hi Moshu,

    That got me started a little. I want to be display all of the authors on a single page with the last 5 posts beneath each respective author.

    Here's what I was able to pull together from other posts:

    <!--
    http://wordpress.org/support/topic/50007?replies=6
    //-->
    <?php
    global $wpdb;
    $authors = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'wp_capabilities' AND meta_value REGEXP \"author|administrator\"");
    foreach($authors as $author) :
    query_posts("author=$author&showposts=1");
    if(have_posts()) the_post();
    ?>
    <h3>Latest post from <?php the_author(); ?></h3>
    <?php
    wp_get_archives('type=postbypost&limit=5&show_post_count=true');
    ?>
    Read all posts by <?php the_author_posts_link(); ?>
    <?php
    endif;
    endforeach;
    ?>

    However, it doesn't work at all.

    Anyone have any ideas I can try?

    Thx
    Cent

  4. cent
    Member
    Posted 7 years ago #

    can anyone provide some more direction? Thanks!

  5. noooneh
    Member
    Posted 6 years ago #

    i remember there was a plugin i downloaded lately but lost with format.... you just put the number of last posts to display... anyone knows it?.. it was called "Posts-by-author" i think!!

  6. noooneh
    Member
    Posted 6 years ago #

    i found the plugin..
    This is exactly what you're looking for, folks....

    http://www.dagondesign.com/articles/posts-by-author-plugin-for-wordpress/

    Check it out..... and damn it's resolved now buddy

    Noooneh

Topic Closed

This topic has been closed to new replies.

About this Topic