
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I checked and I would like to know why you added the same taxonomy filter for "category" two times. One time as drop-down select and secondly as checkboxes?
the first category dropdown will be only a search option for the YEARS category and shall display only some parent categories (i.e. years). The second filter (checkboxes) shall be filter as my ticket request.
Is it possible to display both filters?
if it is not possible to have both category filters, please keep only the checkbox one.
Kindly let me know, thanks,
Franco

Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've removed the drop-down select filter from your view from backend and saved the page:
=> hidden link
I've also disable the cache for the view, please check the following screenshot:
- hidden link
The custom code is adjusted as given under:
add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'func_allow_only_child_terms_in_custom_search_filter', 10, 3 );
function func_allow_only_child_terms_in_custom_search_filter( $args, $taxonomy, $view_id ) {
// target parent term ID
$parent_term_id = 3;
// target taxonomy slug
$target_taxonomy_slug = 'category';
// target view's ID
$target_view_ids = array( 5264 );
// check if specific view
if ( in_array( $view_id, $target_view_ids ) and $taxonomy==$target_taxonomy_slug ){
// get child terms of the target parent term
// $termchildren = get_term_children( $parent_term_id, $target_taxonomy_slug );
// include only those child terms in search filter
$args['slug'] = array('articoli-e-pubblicazioni', 'eventi', 'nella-stampa');
//$args['include'] = array(40,41,42);
}
return $args;
}
Can you please confirm it works as expected.