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

Leave the first comment

 

Related Tutorials..

Create A Customizable AJAX Add To Cart Button In Bricks Builder

Create A Customizable AJAX Add To Cart Button In Bricks Builder

In Bricks, you can simply create an Add To Cart button from a dynamic data / function {woo_add_to_cart}. This button supports AJAX as well if…
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:
Conditional Output on the First Page of Archives in Bricks

Conditional Output on the First Page of Archives in Bricks

How to output an element on an archive page only if we're on the first page of the archive.
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:
Conditionally Outputting Based on Query Count in Bricks

Conditionally Outputting Based on Query Count in Bricks

Update on 22 Sep 2023: There's a much simpler built-in method now. See this post. In the Bricks Facebook group a user asks: Is there…
Categories:
Pro
Showing a Popup conditionally in Bricks based on Query Parameter

Showing a Popup conditionally in Bricks based on Query Parameter

Here's two ways a Bricks Popup can be shown on page load depending on URL parameter value.
Categories:
Tags:
Conditions in Bricks Builder

Conditions in Bricks Builder

The current version of Bricks does not have a built-in Conditions feature but that does not mean we can't set them up manually with custom…
Categories: