[Resolved] Exclude Category except for Single, Archive and Category
I’m trying to exclude all posts on the Home Page alone for category ‘5’, but want the posts displayed in single-post, category and archive view. I also want 8 posts on the Home Page.
If I use the following code inside the Loop, the excluded posts are counted and I get less than 8 posts displayed:
<?php if ( in_category(‘5’) && !is_single() && !is_category() && !is_archive() ) continue; ?>
So, I am thinking of using the following code just before the Loop:
<?php query_posts($query_string . ‘&cat=-5&showposts=8’); ?>
How do I specify not to exclude the posts for category 5 in the other views?
- The topic ‘[Resolved] Exclude Category except for Single, Archive and Category’ is closed to new replies.