Site icon Hip-Hop Website Design and Development

query specific posts according their custom fields, using sql SELECT

My posts have a bunch of custom fields, to help insert and display custom info easily. I am trying to build a search that would select and display posts according values of specific 2 custom fields. The first field “type” is a radio button in my wp-admin, so in database its meta value is always one word. But second field is checkboxes, so in database meta value has several words, and I need to get posts that have the one visitor selects.

What I have so far:

  1. Search form, that consists of 2 dropdowns, each for one custom field. I use it one homepage: pastebin.com/zxPuGduW
  2. A function in functions.php, to select posts according the values set in dropdowns:
    pastebin.com/Z6D0GM4q
  3. A results page to show the posts according selections in the dropdowns form: pastebin.com/KHK0exWn