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

Leave the first comment

 

Related Tutorials..

Pro
Conditional Section when Post has a Featured Image in Bricks

Conditional Section when Post has a Featured Image in Bricks

This Pro tutorial provides the steps to output a Section in Bricks on single posts (of any post type) only if the post has a…
Categories:
Pro
City-based and Country-based Conditional Output in Bricks

City-based and Country-based Conditional Output in Bricks

This Pro tutorial provides the steps to render a Bricks element only if the visitor is from the specified country or city. Note: Caching may…
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:
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…
Pro
Condition for checking Bricks content

Condition for checking Bricks content

Only outputting Bricks content when a Page is built with Bricks, otherwise display WP content.
Categories:
Conditional Output based on Manual Excerpt in Bricks

Conditional Output based on Manual Excerpt in Bricks

How to display a post’s excerpt only if it has been manually set.
Categories:
Pro
Conditional Output in Bricks based on if Content has Headings

Conditional Output in Bricks based on if Content has Headings

How to prevent the output of the table of contents if the content has no headings.
Categories:
Tags: