I've created a Field Group called Brands, in that field group I've added a field with a field name of 'select_brands' of type Checkbox (to be able to select multiple). In the choices I've added this:
bolou : Bolou c6 : C6 deakin francis : Deakin Francis fope : FOPE piero milano : Piero Milano
From this I generate a drop down on the front page, along a second drop down generated from categories (the built in widget in the admin interface).
So, now I can pick – from two different drop downs – a combination of both Brand and Category. But, – I've now tried for three days to get the posts from the DB without any luck (yes, luck is actually what I'm counting on now, 'cause nothing seem to make sense).
Now, from the 3.456.745 different versions of an $args array I've tried, none work. Now, I need some help understanding what parameters I actually need to put where, as I simply can't grasp why this is so hard to get going.
I would expect the following to get me; posts of custom post type 'jewellery' with a category of whatever is selected in the category drop down ($category is an integer from the option value in the drop down) that is also of a specific Brand ($brand is a string from the above options from the custom field).
$args_jewellery = array( 'post_type' => 'jewellery', 'numberposts' => -1, 'tax_query' => array( array( 'taxonomy' => 'category', 'terms' => array( $category ) ) ), 'meta_query' => array( array( 'key' => 'select_brands', <-- IS THIS RIGHT? 'value' => $brand <-- AND IS THIS? ) ) );
How do the fields below relate to my custom post type and its value?
I've even been trying with hard coded values that I KNOW exist, but still get nothing.
'meta_query' => array( array( 'key' => 'select_brands', <-- ? 'value' => $brand <-- ? ) )
And WHY isn't this working? What is it that I'm totally missing here ... ?