1

I'm having trouble figuring out how to query all posts from the post type "events", as well as including four specific pages in the loop.

If I use the "include" parameter, it only returns the specified pages. I figure I can use "exclude" to keep out what I don't want, but that's 50+ pages. Is there a more elegant way to do this?

2

There is not quite any clean way to query for "this set of conditions oh and also something completely unrelated as well".

There are multiple ways to handle it, few of them being:

  • query two things and deal with combining in template or around (easy, pain with pagination)
  • hook into WP_Query and mess with SQL (easy... if you are good with SQL)
  • query or otherwise produce combined set of post IDs, then query for that set (can get heavy, but pretty robust overall)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.