
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've activated the filter.
It simply does not work now.
If all is empty and i select : Utrecht nothing happens. Why? there are two results: Leppers and Van Dam.
But if i check also "nieuwbouwactie" only Leppers shows. Thats not right.
The filter "provincie" does not work right now.

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Please check now: hidden link
It should work now. I've adjusted the code to custom code section as given under:
add_filter('wpv_filter_query', 'func_filter_posts_by_checkbox', 99, 3);
function func_filter_posts_by_checkbox($query_args, $view_settings, $view_id) {
if($view_id == 1227 and (defined( 'DOING_AJAX') and DOING_AJAX) ) {
$is_checked = false;
foreach($_POST['search']['dps_general'] as $k=>$v):
if(isset($v['name']) and $v['name'] == 'wpv-wpcf-nieuwbouwactie-titel[]' and $v['value'] == '1'){
$is_checked = true;
}
endforeach;
$meta_query = $query_args['meta_query'];
$hook_meta_query = array();
foreach($meta_query as $k=>$v):
if(isset($v['key']) and $v['key']=='wpcf-nieuwbouwactie-titel' and $is_checked){
$found_index = $k;
$hook_meta_query = array('relation'=>'OR',
array('relation'=>'AND',
array('key'=>'wpcf-nieuwbouwactie-titel',
'compare'=>'EXISTS'),
array('key'=>'wpcf-nieuwbouwactie-titel',
'value'=>'',
'compare'=>"!=")
)
);
break;
}
endforeach;
if(!empty($hook_meta_query)){
$query_args['meta_query'][$found_index] = $hook_meta_query;
}
}
return $query_args;
}
Goodmorning Minesh (over here),
Almost 🙂 If the "nieuwbouwactie" checkbox would work it would be perfect. Now this does nothing.

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I checked both filters "Provincie" and "Nieuwbouwactie" both works as expected:
- hidden link
Please make sure you should refresh the page and delete the cache.
Wow. Thats it! Thank you very much!