$pages->files()

Returns a $files collection with all files of each page in the collection

  • return ($files object)
<?php foreach($pages->files() as $file) : ?>
<img src="<?= $file->url() ?>">
<?php endforeach ?>

To only get files of a certain type, you can filter by type, e.g.

$pages->files()->filterBy('type', 'image');
$pages->files()->filterBy('type', 'video');
//etc.

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