28th Jan '24
/
2 comments

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 625 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Removing Action/Filter Inside a Plugin’s Namespaced Class Constructor

Removing Action/Filter Inside a Plugin’s Namespaced Class Constructor

Recently worked with a friend figuring out how to remove/undo/cancel an add_action() line that's inside a plugin's constructor inside a PHP Class with the file…
Categories:
Tags:
How to Exclude Elements from Bricks Editor

How to Exclude Elements from Bricks Editor

Bricks has a handy bricks/builder/elements filter using which the available elements that show up after clicking + (or ⌃/⌘ + ⇧ + E) in the…
Categories:
Tags:
Pro
“Truncate text to these many characters” Bricks Control

“Truncate text to these many characters” Bricks Control

Bricks provides a :<number> dynamic data tag modifier that can be used to limit the amount of text by the specified number of words. Ex.:…
Pro
Prefiltering Bricks Terms Query Loop

Prefiltering Bricks Terms Query Loop

Let's say there's a Events CPT with a 'Event Year' custom taxonomy. Sample event year names could be: 2021, 2022, 2024, 2025, 2028 etc. We…