In order to create some layouts with loops and conditional logic, while circumventing Bricks restrictions , it would be great to have a hook to add PHP before and after each query loop item.
I think the names could be
bricks/frontend/render_before_loop_item
bricks/frontend/render_after_loop_item
This should allow to wrap query loop items within HTML tags and give us much, much more flexibility, while Bricks UI stays restricted for query loops.
Okay, we can somehow get there with render_element as replacement and hook into every element and determine if it has the Bricks ID of the loop item.
The bricks/frontend/render_element filter allows you to modify the HTML output of any element in Bricks on the frontend. This powerful hook can be used for a variety of customization tasks, such as adding comments, modifying content, or dynamically...
But even after hours of trying to figure the workaround and writing the wrapping cod, which is not maintainable, I am not there.
do you have a design that you tried to build but failed ?
I am trying to think edge cases.
or just saving couple div wrapper ?
if that is the case I understand.
It is necessary for the linked layout, except if Bricks removes the restriction of loops, which currently only allows a single root element, that is looped.
1 Like