Sibling Terms Bricks Query Loop

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:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro