Hello!
I want to make a list of items in magazine with āload moreā function.
I thought that it would be easier if I cut the list to chunks and then every time I click on āload moreā it will add another chunk.
Does that make sense?
If so, I wonder how do I show only first chunk in template, this is my code:
<?php
$items = $kirby->page('magazine')->children()->listed()
->sortBy('date')
->chunk(2)
?>
<?php foreach ($items as $chunk => $itemsList): ?>
<div class='home-magazine-items-chunk'>
<?php foreach ($itemsList as $item) : ?>
<div><?= $item->title()?></div>
<?php endforeach ?>
</div>
<?php endforeach ?>
Now I see them all together - separated into chunks
Thanks a lot!