How to exclude Posts belonging to only ONE Category from query_posts()
-
I have a need to pull a query_posts similar to this:
query_posts( array( 'post__not_in' => $do_not_duplicate , 'posts_per_page' => $count_non_sticky, 'paged' => get_query_var('paged'), 'cat' => '-944, -938') ); /* 944 Developments 938 AGM Announcements*/
Except that instead of excluding all Posts belonging to either Categories 944 or 938, I want to exclude Posts that belong ONLY to either Category 944 and/or 938.
What I am trying to achieve is to funnel Posts belonging ONLY to one of these categories off to a sidebar block. However if a Post belongs to one of these categories AND also to another one, then I don’t want it excluded from the main content query.
The context is posts which are Announcements, for example. If a post is ONLY an Announcement, then I want it excluded from the main query so I can have it appear only in the Sidebar. But if it’s an Announcement and a Topic Of the Day, then I want it to appear in both he main body of Post Summaries AND the Sidebar.
Does that make sense?
Thank you for any help someone can provide.
- The topic ‘How to exclude Posts belonging to only ONE Category from query_posts()’ is closed to new replies.