Hi Bricks team,
I’m currently trying to use a custom PHP function inside a condition (in this manner) using the dynamic data tag {echo:has_child_product_categories()}
— however, the condition never evaluates correctly, even when the function returns a hardcoded '1'
.
What I’m doing:
I created this simple function via Code Snippets:
function has_child_product_categories() {
return '1'; // hardcoded for testing
}
Then, in the conditions panel of a Bricks element, I set:
I have tried to set:
{echo:has_child_product_categories()}
and
{echo:has_child_product_categories}
The result: the element never shows, as if the condition fails.
I also tested outputting the function directly via a <code>
block, and it correctly returns '1'
.
I’ve tried returning as integer 1
, and boolean true
and nothing worked.
Environment:
- Bricks version: v2.x
- Dynamic data works in content (like in a code block or shortcode), but not in condition fields
- Custom function is loaded using WPCodeBox set to “Always (on page load)” and tested via
echo
successfully.
Expected:
The condition should pass and render the element when the function returns '1'
.
Actual:
The element is never rendered, regardless of the return value.
Could this be a bug in how Bricks parses or executes echo:
in condition logic?
Thanks in advance — happy to provide a demo page or credentials if needed.