[Suggestion] Twig for element conditions

Hi there,

Twig seems to be a game changer for Pro. I was wondering if an upgrade of the element conditions is on the roadmap.

I would love to see an implementation for Twig in the element conditions. Sometimes it’s easier to type and clearer to read.

Also, sometimes I need more complex conditions. For example statement A has to be true with either statement B, C, D or E. Currently you need four groups. Would be great if there was an option for nested conditions.

Just wanted to share the idea. Good luck on the development!

1 Like

Thanks for the kind words.

Could you expand more on what you are trying to do and I can see what we can do on our end to make this easier?

So with the expression group in conditions you can already use Twig. Based on what you said if you use “String in” you can write one statement that can fulfill a number of different conditions. See the screenshot. Let me know if this helps.

Hi Charlie,

Sorry for the late response! This is what I mean:

I don’t know if that is correct Twig, but I think you get the point. The idea is that this is much faster to work with and easier to read. You can even copy paste conditions for multiple elements! Even better, you could make this into a parameter and have the same conditions applied to multiple elements.

I also used an OR statement in combination with an AND statement. In the current design, I have to duplicated the conditions for every post-ID. With twig I can set the conditions ones, and just an OR statement.

1 Like

I gotcha. Yes an expandable text area for a condition would be nice. Currently what you could do is create a custom template in the Theme Options and include it from the Twig: Template (Include) Dynamic content. Then output anything when the condition is met and use is not blank. I don’t think there is dynamic content for if the user is logged in, but I can add that in there pretty quickly for you. Have a great day.