Skip to content

Kirby 3.9.8

$page->changeSort()

Change the position of the page in its siblings collection. Siblings will be resorted. If the page status isn't yet listed, it will be changed to it.

$page->changeSort(?int $position = null): Kirby\Cms\Page

Parameters

Name Type Default
$position int|null null

Return type

Kirby\Cms\Page

This method does not modify the existing $page object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Cms\Page

Example

try {

  page('invisible-page')->changeSort(12);
  echo 'The page is now visible and has the sorting number 12';

} catch(Exception $e) {

  echo $e->getMessage();

}