please help with get_posts()
-
Hello
On my home page i want to display my latest 5 pages OR posts, with an exception of posts from category 3.
I use this code:
<?php $postslist = get_posts('post_type&numberposts=5&offset=2'); foreach ($postslist as $post) : setup_postdata($post); ?> <?php if (in_category('3')) continue; ?> <div id="posti"> <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php the_content_limit(150,'Ve? →'); ?> </div> <?php endforeach; ?>
But the problem is, when in the last 5 posts there is one from category 3, the code shows just 4 posts.
Do you have any idea how to do this, that it will always display 5 posts, no matter if there are any from category 3?Thanks in advance for your time, Marin
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘please help with get_posts()’ is closed to new replies.