Related Projects Snippet

I´m making a Snippet to show other projects on a portfolio site and I´m using the following loop to call the other projects I´ve created.

<?php foreach(page('projects')->children()->visible() as $project): ?>
<h2><?php echo $project->title()->html() ?></h2>
<p><?php echo $project->text1()->excerpt(140) ?></p>
<?php endforeach ?>

The thing is I would like that the four latest projects don´t be displayed on the for each loop, because I´m displaying them above and I don´t want them to be repeated. Is any properly way to begin the loop starting from the fifth project?

Thanks!

http://getkirby.com/docs/toolkit/api/collection/offset

page('projects')->children()->visible()->offset(4)

or maybe try this if indexed starting at zero:

page('projects')->children()->visible()->offset(3)

EDIT: See also http://getkirby.com/docs/toolkit/api/collection/limit

1 Like