WP_Query problem (this must be possible…)
I have a problem on a homepage on which I want to display a loop calling the the last 4 News (cat=20).
I have a Featured panel, where a post from the Blog can be dispayed or one from the News category, using a custom field to select the featured item.
The problem is that if a post form the News is selected as featured, in the News panel I get 3 news instead of 4 (showposts=4).
Featured panel query:
<?php $featured = new WP_Query('meta_key=featured&meta_value=on'); while($featured -> have_posts()) : $featured -> the_post(); $do_not_duplicate = $post->ID; ?>
News panel query:
<?php $news = new WP_Query('cat=20&showposts=4'); while($news -> have_posts()) : $news -> the_post(); if ($post->ID == $do_not_duplicate) continue; update_post_caches($posts); ?>
Why if there are two different query, the News query still cound the fact that in the featured query there is a post from that category and puts only 3 posts and not 4?
How can I work it out so that if I select a post from the News category as featured, the News panel still displays 4 news, not 3?
- The topic ‘WP_Query problem (this must be possible…)’ is closed to new replies.