For that kind of complex query, I’d recommend running two queries and then merging the results.
First, get an array for:
get all posts WHERE ( post_type=”post” AND category = 7 )
Then, get an array for:
( post_type=”case-studies” AND meta_key = ‘homeslide’ AND meta_value = 1 )
Then use array_merge()
to combine the arrays and and you have a collection that satisfies your requirements. Yes, you’re doing to queries … but this seems like a fairly quick/easy short-term solution.
Related Posts:
- Problem with ‘post__not_in’
- Using ajax with paging and a custom sub-query
- When should you use WP_Query vs query_posts() vs get_posts()?
- How to Get All Posts with any post status?
- How can i get count from query post
- query_post by title?
- Wp get all the sub pages of the parent using wp query
- How to query for most viewed posts and show top 5
- WP_Query vs get_posts
- How to set posts per page using WP_Query()
- query_posts() in function makes global $wp_query out of sync?
- Query Custom Meta Value with Increment
- Get posts by meta data OR title
- Sort posts alphabetically by custom field value, insert divider between different letters
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- Perform query with meta_value date
- WP_Query ordered by custom field that is a date string?
- Sort X categories by last update and show image
- Custom Post Type “Event”: chronological list of recurring events
- using post__in allow duplicate post id
- Using dynamic conditions in ‘posts_where’ filter
- How to limit search to first letter of title?
- Total Count of Posts NOT in Selected Categories?
- Counter code for paginated category pages in wordpress
- WordPress Search Filter Only for Page with Child of Child of Child of Child of Child
- pagination in author.php template returns 404 error
- How to modify the query to exclude posts by slug?
- Pass the same object to multiple widgets in a template with one query
- How to Loop within a Loop (Display Children and then Grandchildren)
- Retrieve or Query Pages by ID
- How do you query wordpress posts using a math formula between multiple meta field values?
- How to implement time filter to show random post 1 month for one category and 3 months for other categories
- Page navigation doesn’t show when query category
- Adding Variables to post query
- Exclude posts with empty post_content in wp_query
- Order posts using a custom array
- Improving WP_Query for performance when random posts are ordered
- How to query a custom post type with a taxonomy filter but display post type archive page?
- WordPress pagination showing same posts on each page
- query_posts() ALWAYS displays something?
- Change query_posts to WP_Query in page but does not work
- Query last updated posts (posts updated in the last 24 hours)
- Custom Query num_rows returns wrong amount
- Search breaks when querying main loop for category
- Slow page loads due to WordPress Core Query
- Different Ways to Query Custom Post Types?
- Query Page Content From Theme Options?
- posts_per_page option limits the number of Gallery items
- Custom loops, sticky posts, and pagination nightmare
- Each post is showing twice in my custom query…?
- How can I override one post and make it display content for another post?
- Include current post into loop
- Filter post query to only show direct children of category
- Query for first 3 posts to change the look and feel
- Exclude posts by post meta value
- Should I reset $wp_query?
- How to give classname to post if post has no content?
- Why doesn’t my WP Meta Query return any results?
- Can I use WP_Query one time and then filter the results multiple times
- Different layout based on post amount?
- How to solve this without flushing the rewrite rules for each post query the visitor triggers?
- How to check a list or feed of all posts under a category and tag?
- Best Query for blog posts
- odd behaviours from template tags
- Having an issue doing a WP_Query with post_content and category__and
- Custom query looking at multiple custom fields and properly sorting
- Pre-existing arguments when using queries
- Filter products on category AND tag
- pre_user_query vs pre_get_posts
- Get posts that match defined arrays of tags
- I need query_posts() to order results first by a meta value and then by post ID
- Show 5 posts and than 3 posts offset with pagination
- How to show post title in content editor in backend?
- My entry results are not consistently alphabetized
- Merge two queries and remove duplicate
- WP Query Relations / Compare
- Ordering Posts by parent category, name ascending
- Sort / Filter Queries
- Optimising specific Query with ACF meta objects
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to organize a WP_Query’s list of posts by category and display category title?
- When should you use WP_Query vs query_posts() vs get_posts()?
- Query Posts From Multiple Post Types
- How to query post ids liked by the Author
- WordPress Query showing multiple titles
- Query Posts by date range with fixed beginning and end
- custom query to get posts
- WP-Snap too slow (caused by WP_Query?)
- Adding Category Argument into an Array for WordPress Query
- How to refine WP-Query with further criteria
- Run second query on page based on author of the first query
- Query Posts (post meta)
- Does wp_query and query_posts affect website performance? [duplicate]
- how to retrieve specific product attribute value in an sql query?
- Order post by year DESC and month ASC
- Showing specific post in order of array wp_query
- WP MS: How to query over the network
- Problem with my loops
- Filter posts/pages by user_role array