[Resolved] query filtered by category still gets the wanted number of posts
I want to display exactly the last four posts, excluding posts from 2 categories (and a “do not duplicate” post)
So I wrote :
<?php query_posts('showposts=4'); ?><br />
<?php while (have_posts()) : the_post(); $do_not_duplicate = $post->ID; ?><br />
<?php if ( in_category('5') ) continue; ?><br />
<?php if ( in_category('2') ) continue; ?><br />
<!-- do stuff --><br />
<?php endwhile; ?>
WP get the last four posts, and doesn’t display the post from cat 5 & cat 2. Well, “it works”.
Problem is : if one or more posts from the last four is in cat 5 or 2, it doesn’t display.
So I may have 0, 1, 2, 3 or 4 posts displaying (if 4, 3, 2, 1 or 0 posts from last four is in cat 5 / 2).
How can I “solve” this, and be sure to have four posts displayed ?
- The topic ‘[Resolved] query filtered by category still gets the wanted number of posts’ is closed to new replies.