I want to create a loop for my posts which wraps a and class to every three posts group. The tricky part is that there are 3 different classes which need to keep looping.
So, basically it should create a div with a class of "right" wrapping around the first 3 posts and then a second div with a class of "left" wrapping around the next 3 and a third div wrapping around the next 3 ones after that.
This pattern needs to repeat as the posts go on.
It will look something like this:
<div class="right">
<div>Post 1</div>
<div>Post 2</div>
<div>Post 3</div>
</div>
<div class="left">
<div>Post 4</div>
<div>Post 5</div>
<div>Post 6</div>
<div class="inner-div"></div>
</div>
<div class="middle">
<div>Post 7</div>
<div>Post 8</div>
<div>Post 9</div>
<div class="inner-div"></div>
</div>
And repeat
Ive tried this: PHP loop: Add a div around every three items syntax But its only adding the first class and then repeating the second class.