5th Aug '25
/
0 comments

Conditionally Hide a Section on a Specific Taxonomy’s Term Archives in Bricks

A user asked:

I have a CTA in the footer of my site, which I have custom fields on various templates, etc to populate.

I don’t want it on a custom taxonomy archive (service-types), but I can’t for the life of me see how to hide that section on those alone.

CPT: service
Custom Taxonomy: service-type

Requirement: output a section everywhere except on taxonomy term archives of service-type.

This can be done by whitelisting the is_tax() WordPress function and using it with a dynamic data condition in Bricks.

Step 1

Whitelist the is_tax function.

Ex.:

<?php 

add_filter( 'bricks/code/echo_function_names', function() {
  return [
    'is_tax'
  ];
} );

You should also add other functions (native or custom) being used in your Bricks instance besides is_tax. This can be checked at Bricks → Settings → Custom code by clicking the Code review button.

More info on whitelisting can be found here.

Step 2

Edit your template having the section that you wish to not be displayed on the taxonomy term archive pages.

Add a dynamic condition like this:

{echo:is_tax(service-type)}

This will make the section be rendered everywhere except on the service-type term archives.

Get access to all 626 Bricks code tutorials with BricksLabs Pro

Leave the first comment

 

Related Tutorials..

[Function] Current Term Has Children

[Function] Current Term Has Children

Updated on 20 Jul 2024 A user asks: I'm working on an archive template for WooCommerce products. I'm trying to hide a section if there…
Conditional Rendering for Logged in/out Users by CSS Classes in Bricks

Conditional Rendering for Logged in/out Users by CSS Classes in Bricks

This tutorial shows how Bricks builder's bricks/element/render filter can be used to conditionally output elements having a class of logged-in to logged-in users only and…
Categories:
Check if a given category has at least one post

Check if a given category has at least one post

There could be situations where you want to check if a given category (by its slug) has at least 1 post assigned to that category.…
Categories:
Pro
ACF Repeater sub field value dynamic data condition in Bricks

ACF Repeater sub field value dynamic data condition in Bricks

This Pro tutorial provides the steps to output an element on single posts (can be of any post type) only if a specified ACF (Pro)…
Is WooCommerce Cart Empty Condition in Bricks

Is WooCommerce Cart Empty Condition in Bricks

Updated on 5 Nov 2024 Looking to conditionally render an element depending on whether the user's cart is empty or not when using WooCommerce? Add…
Checking if Repeater/Cloneable Meta Fields Are Empty in Bricks

Checking if Repeater/Cloneable Meta Fields Are Empty in Bricks

Creating a condition to ensure that a section only gets output if at least one row of data is filled in.
Categories:
Pro
Conditional Rendering in Bricks Based on CSS Class

Conditional Rendering in Bricks Based on CSS Class

Updated on 19 Jun 2024 A user asks: Is there a way to apply the same conditions to several elements like we set styles appending…
Categories:
JetEngine Checkbox Condition in Bricks

JetEngine Checkbox Condition in Bricks

How elements in Bricks can be conditionally output depending on the selected option from a JetEngine checkbox field.
Categories:
Tags: