$site->createChild()
Creates a main page
$site->createChild(array $props): Kirby\Cms\Page
Parameters
Name | Type | Default |
---|---|---|
$props * | array |
– |
Return type
Parent class
Example
Programmatically create a new page as child of the $site
object.
<?php
$kirby->impersonate('kirby');
$newPage = $site->createChild(
[
'slug' => 'blog',
'template' => 'blog',
'isDraft' => false,
'content' => [
'title' => 'Blog',
]
]
);