I am trying to implement a calendar listing with dynamically added month dividers by porting an already working Oxygen EasyPost element to Bricks. However, I fail with a simple and efficient implementation which only requires a single query and supports pagination (max posts per page).
There is a BricksLabs tutorial, which doesn’t achieve all goals and requires custom queries and three query loops in total. For a day divider, it would probably need four query loops.
Currently, Bricks would create an HTML structure of this
<div>
<h2>July 2024</h2>
<div>Summer harvest festival ...</div>
</div>
<div>
<h2>September 2024</h2>
<div>Career practitioner ...</div>
</div>
<div>
<div>Another posts in september ...</div>
</div>
However, with a query loop on a dummy element that wraps the conditionally enabled month divider and the post as usual, it would be possible to implement this with a single query and full pagination support. As I already did in Oxygen.
<h2>July 2024</h2>
<div>Summer harvest festival ...</div>
<h2>September 2024</h2>
<div>Career practitioner ...</div>
<div>Another posts in september ...</div>
And even better would be a more valid HTML output like
<div>
<h2>July 2024</h2>
<div>Summer harvest festival ...</div>
<div>
<div>
<h2>September 2024</h2>
<div>Career practitioner ...</div>
<div>Another posts in september ...</div>
</div>
This could be achieved by allowing the code element to output half of an HTML tag <div> and another contains the second half </div>, whereas elements in between are wrapped inside this div.
Also pre/post-item hooks could help to add dividers. Any idea and convenient feature is highly welcome.