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

Leave the first comment

 

Related Tutorials..

Pro
Day of Week Condition in Bricks

Day of Week Condition in Bricks

Displaying elements conditionally based on the current day of the week.
Categories:
Bricks Condition for WishList Member

Bricks Condition for WishList Member

How to render a Bricks element only if the user has access to a specified WishList Member level.
Categories:
How to conditionally load your scripts based on an ACF field

How to conditionally load your scripts based on an ACF field

This tutorial provides the PHP codes that can be pasted in order to enqueue your scripts conditionally based on the value of an ACF field…
Categories:
Pro
At Least 1 Search Result Condition in Bricks

At Least 1 Search Result Condition in Bricks

Registering a custom condition to render elements depending on whether there is at least one search result.
Categories:
Pro
Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

This Pro tutorial provides the steps to modify a ACF Repeater query loop to only output the rows for which a True / False type…
Categories:
Pro
Checking ‘PublishPress Future’ plugin’s Future Action enabled posts

Checking ‘PublishPress Future’ plugin’s Future Action enabled posts

PublishPress Future is a handy plugin for scheduling actions like unpublishing or deleting posts (of any post type) at a specified date and time in…
Categories:
Pro
Conditionally Rendering an Element Outside the Loop based on Taxonomy Term in Bricks

Conditionally Rendering an Element Outside the Loop based on Taxonomy Term in Bricks

A user asks: Hiding element based on taxonomy I have an element in a footer that I want to hide if a page has a…
Categories:
Pro
Query Variables Condition in Bricks

Query Variables Condition in Bricks

This Pro tutorial provides the steps to register a custom function that returns true or false depending on whether the current page URL has specific…