WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Separate Two Author's Entries Into Two Lists/One Page (3 posts)

  1. scriptdog
    Member
    Posted 7 years ago #

    I've scoured the support forums, and people have asked this question before in round about ways, but there's not been a concise answer.

    I have two authors on my blog. I intend on creating a three column blog, one author's posts on the left, the other author's post on the right, with navigation, links, etc. down the center.

    I understand it's a case of fiddling with the Loop, but I'm just curious if there's a clear cut example of exactly what changes in code need to be done on the backend to create these two separate lists?

    I don't have a problem with the css required to build spaces for the author's lists, and I don't need to separate by category, I just need to separate by author...

    Does it involve rewinding the Loop since it can only be queried once? I have a basic understand of PHP, I just need help being directed in the right direction...

    Any help would rock my socks off, thanks!

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    No, you don't have to rewind. Rewinding is for when you want to loop through the same posts again. You don't want to do that.

    What you want is the magical query_posts() function. Quickie example:

    <div id="left">
    <?php
    query_posts('author_name=Otto');
    while (have_posts()) : the_post();
    <!-- stuff to display the posts here -->
    endwhile;
    ?>
    </div>
    <div id="right">
    <?php
    query_posts('author_name=SomebodyElse');
    while (have_posts()) : the_post();
    <!-- stuff to display the posts here -->
    endwhile;
    ?>
    </div>

    See what I did? Two loops. Two queries. Two Authors. One of them in a div called "left", the other in a div called "right". Now, you also need styling to get those divs to turn into columns and such, but hopefully you get the idea.

  3. scriptdog
    Member
    Posted 7 years ago #

    Fantastic, exactly what I was looking for. Thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Topic