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

Get access to all 525 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Outputting Only the First ACF Repeater Row in Bricks

Outputting Only the First ACF Repeater Row in Bricks

Updated on 12 Dec 2023 In the Bricks Facebook group a user asks: How can I display only the first entry from an ACF repeater?…
How to Add a Custom Control Field to an Element in Bricks

How to Add a Custom Control Field to an Element in Bricks

In this tutorial, we'll learn how to add a custom control field to an element and dynamically change a CSS property inside the builder. Introduction…
Categories:
Tags: