Adding active class to the current term/post in a Bricks query loop on Term archives/single posts

Updated on 29 Feb 2024

In the Sibling Terms Bricks Query Loop tutorial, a member asked:

How can I set the class "active" to the current category ?

This Pro tutorial shows how.

This also applies to a posts query loop when viewing a single post, not just terms.

Step 1

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