Updated on 7 Feb 2024
In the Bricks Facebook group a user asks:
This Pro tutorial shows how bricks/terms/query_vars filter can be used to limit the terms of a Bricks Terms-type query loop to only the children of the current term’s parent i.e., sibling terms on term archive pages.
We shall also cover the case where you may want to exclude the current term.
Step 1
Create a Bricks template of type Archive.
Edit it with Bricks and set a template condition such that it applies to all terms of your desired taxonomy.

Add a Section and inside its Container, a Heading whose text is set to:
{archive_title}
Add another Section and inside its Container, set up a query loop like this:

Note: If empty terms are to be output, make sure the corresponding query options control is enabled AND you add 'hide_empty' => false in the code below.
Step 2
Add the following in child theme‘s functions.php (w/o the opening PHP tag) or a code snippets plugin:
<?php
// Include only current term's sibling terms.
add_filter( 'bricks/terms/query_vars', function( $query_vars, $settings, $element_id ) {
if ( $element_id !== 'itacmw' ) return $query_vars;
// current term
$term = get_queried_object();
$query_vars['include'] = get_terms( [
'taxonomy' => $term->taxonomy,
'fields' => 'ids',
'parent' => $term->parent,
] );
return $query_vars;
}, 10, 3 );
Replace itacmw with the Bricks ID of the query loop-enabled element.
If you’d like to exclude the current term, change
$query_vars['include'] = get_terms( [
'taxonomy' => $term->taxonomy,
'fields' => 'ids',
'parent' => $term->parent,
] );
to
$query_vars['include'] = get_terms( [
'taxonomy' => $term->taxonomy,
'fields' => 'ids',
'parent' => $term->parent,
'exclude' => $term->term_id,
] );
