Can I show and hide an element based on if Metabox is empty or not using BricksForge?

I wonder if somebody wouldn’t mind helping me with a problem, please.

I’m using Bricks and Metabox.

I have two bottoms on a page. I’d like to hide one button if the Metabox field is empty and another to hide if the Metabox field is not empty. The Metabox field type is a URL field. The reason for the 2 buttons/links is that I have a button to take users to a contact form. I’ve used it as place holders my services page while I build out each service page. Each service is in a query loop. As I build out each page, I’ll swap to the second button to take the user to the service page.

I can hide the button just fine if the Metabox field is empty using the conditions in Bricks.

image

Would anyone know how to hide an element in bricks if a Metabox field is populated by any chance?

I edited the post and changed it to a possible bug. and let the Bricks team know.

I used a global button that didn’t work but worked fine when I added the plain button. The condition below button only shows if the button is blank below.

image

Hi seaj1one, do this;

bricks-button-dynamic-conditions

I added a Metabox Custom field to the bottom of my footer template, added a URL in the footer in WordPress editor, opened Bricks editor, added a button. Called the URL dynamically from the Metabox field. Set the Button condition as above. With URL it displays, without it doesn’t.

Hello @WebVA

Thank you for replying. See you your example where you’ve got not empty and show and the reverse where it’s = to blank to show it works with standard button elements but not global elements.

It’s been confirmed as a recent bug.

In a lot of ways, Bricks forge seems more powerful.

Don’t you know of a way to do conditional logic within Bricks forge by any chance?

It’ll be cool if you did :pray:

Hi :slight_smile: Bricksforge has no conditional logic implemented yet, until Bricks will introduce the official Conditional Logic API. It’s planned and I’m sure we will get it soon. Then we can extend this important part of Bricks :wink:

1 Like