Feature Request - Conditions for elements

I can’t remember if you’ve said this would be coming in a future release, but now that we’ve got conditional statements for Layouts & Headers, I’d really love to be able to apply them to specific elements too.

One use case for me is turning on/off whole bars in the headers. For example, I have a standard header bar I want to appear on every page, and I’d like to have a second bar with some additional stuff in it (title, share links, etc.) – but only have that appear on blog posts.

I know I can accomplish this by building the primary header, then duplicating it, then adding specific conditions & a higher priority… but that gets cumbersome to support if I ever change the styling on the primary header.

Another use case I immediately ran into was that I want to build a single blog post layout, and have it support posts with and without featured images. In my case, I only want to display the image if there is one – but it appears the current layout builder outputs the empty image element if there isn’t a featured image set.

image

1 Like

Yes! That would be really awesome. In theory, we could repurpose that whole assignment control behavior and about 80% of the code powering the condition logic and add this to elements. It’s something we’ve talked about exploring towards the end of the cycle since it will take some time to build out properly. If we don’t get it in this release it will likely be in a following smaller release.

It will be really powerful for cases exactly like you’ve described. Another one would be reusing a Layout for multiple post types, but being able to have meta areas that are subtlety different.

On top of that, you could have entire sections that output based on a user being logged in or having a certain user role. So many possibilities open up.

Yup, so much awesomeness. I’ll look forward to those, whenever they roll out :grinning:

While waiting for this release, I wanted to explore some layout builder concepts… so I played around with Oxygen for a bit. I really don’t like their UI, but they have a whole bunch of powerful conditions for individual elements. And third party plugins can register additional conditions too (for things like advanced WooCommerce conditions, time of day, etc.).

1 Like

Sounds great! Let me know if there’s anything other ideas from Oxygen you think would play well in Pro, or would round things out. Something I think they did a great job at was the Repeater element. The Archive builder mode will have something similar, except it will just be a setting you can turn on for Layout elements (potentially more).