I’m having a hard time making it work via the backend settings, can anyone help me?
I have an archive template for custom taxonomy term.
For the current selected term i want to display it’s child terms.
I can achieve this via php:
add_filter( 'bricks/terms/query_vars', 'gbe_query_vars_terms_filter', 12, 3 );
function gbe_query_vars_terms_filter( $query_vars, $settings, $element_id ) {
if( $element_id == 'fac21f' ) {
$parentID = get_queried_object()->term_id;
$children = get_terms( 'servizio', array( 'parent' => $parentID, 'orderby' => 'slug', 'hide_empty' => false ) );
$query_vars['exclude'] = [ $parentID ];
$query_vars['include'] = array();
foreach ( $children as $child )
{
$query_vars['include'][] = $child->term_id;
echo $child->term_id;
}
}
return $query_vars;
}
Can I make this work using the back-end settings only?