Skip to content

$pages->shuffle()

Shuffle all elements

$pages->shuffle(): Kirby\Toolkit\Collection

Return type

Kirby\Toolkit\Collection

Parent class

Kirby\Cms\Pages inherited from Kirby\Toolkit\Collection

Example

<h2>Random subpages</h2>
<ul>
  <?php foreach($page->children()->shuffle() as $subpage): ?>
  <li>
    <a href="<?= $subpage->url() ?>">
      <?= html($subpage->title()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>

More information

Random content