- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’m trying to display a list of recent posts from a specific category. I’ve been scouring all over the interweb looking for solutions, and everything I try only works half way.
No matter what I do, the resulting list displays 6 posts, regardless of what I set it to. Both of the following seem to work, yet they both return 6 posts. At first I thought I must be missing something, but after trying countless different options, and noticing that it’s always 6 posts, I’m thinking there’s something else at work. Any ideas?
$recentposts = get_posts('numberposts=3&category_name=portfolio');
foreach ($recentposts as $post) :
setup_postdata($post); ?>
- ">
In the first query_posts there should be no spaces after ‘portfolio’.
Also, you should be clearing your query_posts with:
I noticed the blank space as well but figured that wasn’t the problem (at this point my priority is to just get it working).
I’m also very rusty right now, but I don’t remember having such issues with simple things like this.
Is this more proper?
Still doesn’t work. There’s 4 posts in that category and all 4 are listed rather than 3
Try showposts=3 rather than posts_per_page=3
PERFECT! That seems to do the trick.
Thanks for the help to both of you!