Hi, so on the home page of a website I’m currently working on I am trying to display posts in that are in multiple categories on the homepage. I’m trying to display posts in categories 8, 4, 3 and also display posts just in category 6.
Here is my current query:
<?php query_posts(array('category__and'=>array(8,4,3))); ?>
It was originally:
<?php query_posts(array('category__and'=>array(8,4,3)&array(6))); ?>
But that just screwed it up and displayed all categories.
The reason I’m trying to do this is because I on the website I’m working on http://www.w-lbaseball.org there are posts in categories: Announcements, Games, and Schedule. But there are some posts that are only located in only ‘Games’ & ‘Schedule’, these posts have no content but have custom fields used to display info on the scheduling page and the sidebar. I don’t want them to show up on the homepage unless there in the category ‘Announcements’ also. The news category is a separate category that I want to use strictly to display any current news but not be require to be in any of the three other categories.
Any assistance with this dilemma is very much appreciated.
- The topic ‘How to set query_posts to return and display two sets of multiple category posts’ is closed to new replies.