WordPress.org

Ready to get started?Download WordPress

Forums

Problems with query_posts() (1 post)

  1. Garet McKinley
    Member
    Posted 2 years ago #

    Okay, so this problem has been bothering me for a while, basically I need to write a VERY complex query for wordpress.

    Here's an example of what I'm trying to do.

    Post 1 has a title "My mac computer is shiny"
    Post 2 has a title "My windows computer is really slow"
    Post 3 has a title "My linux computer is shiny"

    Now, I'm writing a keyword filter. I have the following keywords that can be toggled:

    Mac
    Windows
    Linux
    Shiny
    Slow

    Now, basically when you check the box it'll look through the title of the posts and pull posts containing the keywords. This all works perfect, but I need to find a way to do multiples... okay, no problem right? Just use 'relation' => 'OR' for the meta_query.

    WRONG. Because I also have options above for combining the keyword filter with a category filter. So if I use 'relation' => 'OR' It'll display if it has EITHER the category or the keyword. I need it to display ONLY if it's in the selected category and contains the keywords.

    Any way to do this?

    [No bumping. If it's that urgent, consider hiring someone.]

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 2 years ago by Garet McKinley
  • This topic is not resolved
  • WordPress version: 3.3.2