Creates chunks of the same size and returns them in a new collection

  • since: Kirby 2.3.2
  • $size (int)
    Number of items per chunk
  • return ($collection)

This documentation entry is inherited from the Collection class.


<?php $chunks = page('projects')->children()->chunk(4); ?>
<?php foreach($chunks as $items): ?>
  <div class="row">
    <?php foreach($items as $item): ?>
    <article><?= $item->title() ?></article>
    <?php endforeach; ?>
<?php endforeach ?>

Is something missing or incorrect? Edit this page on Github…