Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Split WireArray/PageArray into chunks
// Thanks to netcarver >
$items = $pages->find('#whatever'); // Find your stuff
$parts = 3; // How many items should there be in 1 chunk?
$chunked = array_chunk($items->getArray(), $parts);
foreach ($chunked as $chunk) {
foreach ($chunk as $item) {
// Do stuff like echo $item->title;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment