Forum
Issues With perch:every nth-child
I have this code Drew kindly helped with:
<perch:every nth-child="3n+1"><div class="row"></perch:every>
<div class="one_third<perch:every count="3"> last</perch:every>">
<div class="cont-area">
</div>
</div>
<perch:every nth-child="3n"></div></perch:every>
The template outputs a row wrapped around every 3 items added. Problem is if there are not 3 items in a row the last statement above does not get triggered so it misses a closing </div> tag. How can I adapt this to add this?
I can see why it does not.
Not sure if this helps anyone else, but I found a solution using javascript that seems to generate the html.
I added this to the page template:
and stripped the above to:
Seems to work.
So you're all sorted now?