I’m trying to get a nested loop working that will display 6 posts with a certain code, then go back, display the same 6 posts with a different code and then continue doing this until there are no more posts.
Example:
A B C D E F
a b c d e f
G H I J K L
g h i j k l
So far I’ve managed to find this code:
http://pastebin.com/hBkYvy6U
but it only repeats the loop on the first 6 posts and, afterwards, it simply outputs the posts once.
Probably the second output isn’t nested correctly into the first one, can anyone help me figure this out?
Try changing line 27 to use modulo % operator or fmod function instead of if($count == 6 )
That should give your the expected result for all items in the list by repeating this action for every post 6 at a time (6,12,18,24,…).
I believe you just need to reset your count = 0 after you find that count = 6
ie: