I have a collection of posts for families. I'm using the simple fields plugin for handle members of the family. Is there a simple way to query posts based on values from the custom fields created by the simple fields plugin.
I see the meta keys in the admin:
_simple_fields_fieldGroupID_6_fieldID_1_numInSet_0 _simple_fields_fieldGroupID_6_fieldID_2_numInSet_0 _simple_fields_fieldGroupID_6_fieldID_3_numInSet_0 _simple_fields_fieldGroupID_6_fieldID_1_numInSet_1 _simple_fields_fieldGroupID_6_fieldID_2_numInSet_1 _simple_fields_fieldGroupID_6_fieldID_3_numInSet_1
where fieldID_1 is a dropdown for year (1950-2010),
fieldID_2 is a dropdown for gender (male or female)
fieldID_3 is a textfield for name
How would I query to get all posts where gender is 'male' and ordered by year?
There are numInSet_N values. Some might have 0, others 10 or more.
The simple fields plugin creates generic values for each key. For example, _simple_fields_fieldGroupID_6_fieldID_1_numInSet_0 is a dropdown for year and has the following key values:
dropdown_num_2 dropdown_num_3 dropdown_num_4 ... dropdown_num_62
Where dropdown_num_2 is actually 1950, dropdown_num_3 is 1951 and so forth.
The same is true for the gender dropdown, _simple_fields_fieldGroupID_6_fieldID_2_numInSet_0, which has the following key values:
Where dropdown_num_2 is actually 'male', dropdown_num_3 is 'female'.
So the query to get all posts where gender is 'male' and ordered by year would need to check _simple_fields_fieldGroupID_6_fieldID_2_numInSet_N == 'dropdown_num_2' and ORDER BY the year of all matched posts.