get_posts problem: several categories
-
I was using this code to display 5 posts from just one category in my sidebar, but when I started adding sub-categories to all posts I noticed they wouldn’t show up. Here’s the code:
<?php $posts = get_posts( "category=3&numberposts=5" ); ?> <?php if( $posts ) : ?> <?php foreach( $posts as $post ) : setup_postdata( $post ); ?><p><div class="descriptionblack"><a href="<?php the_permalink() ?>" title="Japan News Review - <?php the_title(); ?>">(etc)The posts are only members of one category (the sub-category) and unfortunately making the posts members of the base category isn’t an option (because of the way I’ve built the site).
<?php $posts = get_posts( "category=3&numberposts=5" ); ?>this is the line I need to change, right? I bet it’s really simple, but I don’t know what it is I should add and how.
Any help would be much appreciated!
The topic ‘get_posts problem: several categories’ is closed to new replies.