I’ve really tried to search for an answer to this question but have been unsuccessful. I hope I’ve not bothering you with something stupied.
The thing is, I have a group blog with three authors. I would like to have three columns on my first page, one for each author, displaying their last five posts beside each other.
YY | XX | ZZ YY | XX | ZZ YY | XX | ZZ YY | XX | ZZ YY | XX | ZZ
(Not sure of the illustration made it better, but well, the YY, XX, ZZ represents posts from different authors, of course.)
I thought, naïve as I am, that this would be really easy to do using multiple loops, but no matter how close I look I can’t seem to find a solution. There should be a way of hard-coding it, right? I’m using a custom theme so putting the author-ID’s in the code wouldn’t be a problem.
Is anyone out there kindhearted enough to give me a hand, or at least point me in the right direction? 🙂
The codex explains multiple loops pretty well. Perishable Press also has an article titled ‘Multiple Loops and Multiple Columns with WordPress, (X)HTML and CSS‘.
@apljdi: Thanks for your swift reply. However, I’ve been through the codex, and like I said, while I realize that multiple loops is what I will eventually use, I still don’t know how to filter for author.
The example in the codex is for category, and well, I guess I’m not enough of a hacker to just “know” how to filter for authors instead.
Looking at the code in the example you provided:
<?php $posts = get_posts('numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?>
…makes me think that maybe there is an argument to get_posts to include only one author. But no such luck, it seems.
Hmm, or am I confused here? 🙂
Here is perhaps an even better example (from weblogtoolscollection) of what you need to do. The first loop you can do with query_posts(). There are Author Parameters for you to use to select only one author. For each of the other two authors you’ll need to create a new query object– the weblogtoolscollection link explains how.
- The topic ‘List posts from specific authors on the first page’ is closed to new replies.