I have a simple foreach loop like:
foreach ( $posts as $index => $posts )
and also a counter:
if( $index % 5 + 1 == 5 ) {
//do something
}
I have 15 posts per page and it should do something every fifth item but NOT on the last but how do I do that?
So it becomes:
POST
POST
POST
POST
POST
DO SOMETHING
POST
POST
POST
POST
POST
DO SOMETHING
POST
POST
POST
POST
POST
If you know, you have 15 posts, and need every 5th but not the last…
That means you need to ‘make something’ with the 5th and 10th one, am i right?
So why not check that?